When IP addresses are reused by docker, and this code is run
concurrently, CONTAINER_MAPPING[ip] can be removed in one thread while
client.inspect_container is running in another (as it does IO and can be
paused by gevent). Previously, this could cause a get or delete of
CONTAINER_MAPPING[ip] after client.inspect_container to fail.
When IP addresses are reused by docker, and this code is run concurrently,
CONTAINER_MAPPING[ip]
can be removed in one thread whileclient.inspect_container
is running in another (as it does IO and can be paused by gevent). Previously, this could cause a get or delete ofCONTAINER_MAPPING[ip]
afterclient.inspect_container
to fail.