Remove semaphore where no longer required and re-enable

This commit is contained in:
Sebastian Serth
2020-03-22 16:53:14 +01:00
parent 7b10da8eb4
commit ccb5998b72
2 changed files with 10 additions and 21 deletions

View File

@ -313,7 +313,7 @@ class DockerClient
# remove container from pool, then destroy it
if (DockerContainerPool.config[:active])
DockerContainerPool.acquire_semaphore
DockerContainerPool.remove_from_all_containers(container, @execution_environment, bypass_semaphore: true)
DockerContainerPool.remove_from_all_containers(container, @execution_environment)
# create new container and add it to @all_containers and @containers.
# ToDo: How long does creating a new cotainer take? We're still locking the semaphore.
@ -321,7 +321,7 @@ class DockerClient
if missing_counter_count > 0
Rails.logger.error('kill_container: Creating a new container.')
new_container = self.class.create_container(@execution_environment)
DockerContainerPool.add_to_all_containers(new_container, @execution_environment, bypass_semaphore: true)
DockerContainerPool.add_to_all_containers(new_container, @execution_environment)
else
Rails.logger.error('Container killed and removed for ' + execution_environment.to_s + ' but not creating a new one. Currently, ' + missing_counter_count.abs + ' more containers than the configured pool size are available.')
end