service: avoid taking another lock in the usual case

pull/607/head
David Wilson 7 years ago
parent 50bfe4c746
commit e93762b3db

@ -547,6 +547,9 @@ class Pool(object):
invoker.service.on_shutdown()
def get_invoker(self, name, msg):
invoker = self._invoker_by_name.get(name)
if invoker is None:
# Avoid acquiring lock if possible.
self._lock.acquire()
try:
invoker = self._invoker_by_name.get(name)

Loading…
Cancel
Save