Extract semaphore handling to own methods and add logging

This commit is contained in:
Sebastian Serth
2020-03-22 11:35:04 +01:00
parent 83ba0a3f4b
commit 3102d1529f
2 changed files with 28 additions and 16 deletions

View File

@ -306,7 +306,7 @@ class DockerClient
Rails.logger.info('killing container ' + container.to_s)
# remove container from pool, then destroy it
if (DockerContainerPool.config[:active])
DockerContainerPool.semaphore.acquire
DockerContainerPool.acquire_semaphore
DockerContainerPool.remove_from_all_containers(container, @execution_environment, bypass_semaphore: true)
end
@ -317,7 +317,7 @@ class DockerClient
# create new container and add it to @all_containers and @containers.
container = self.class.create_container(@execution_environment)
DockerContainerPool.add_to_all_containers(container, @execution_environment, bypass_semaphore: true)
DockerContainerPool.semaphore.release
DockerContainerPool.release_semaphore
end
exit_thread_if_alive
end