Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment