Commit a3c10d31 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

http.client: Reduce performance impact by assertion



Call dict.values once instead of N times.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 00267bfe
......@@ -352,10 +352,11 @@ class HttpClientPool:
"""Returns HTTP clients to the pool.
"""
assert not frozenset(pclients) & frozenset(self._pool.values())
for pc in pclients:
self._logger.debug("Returning client %s to pool", pc)
assert pc.identity not in self._pool
assert pc not in self._pool.values()
self._pool[pc.identity] = pc
# Check for unused clients
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment