Merge pull request #387 from mcella/378
Fixes #378: must acquire JID_CACHE_LOCK before adding to JID_CACHE
This commit is contained in:
commit
2c69144189
@ -72,9 +72,8 @@ JID_CACHE_LOCK = threading.Lock()
|
|||||||
JID_CACHE_MAX_SIZE = 1024
|
JID_CACHE_MAX_SIZE = 1024
|
||||||
|
|
||||||
def _cache(key, parts, locked):
|
def _cache(key, parts, locked):
|
||||||
JID_CACHE[key] = (parts, locked)
|
|
||||||
if len(JID_CACHE) > JID_CACHE_MAX_SIZE:
|
|
||||||
with JID_CACHE_LOCK:
|
with JID_CACHE_LOCK:
|
||||||
|
JID_CACHE[key] = (parts, locked)
|
||||||
while len(JID_CACHE) > JID_CACHE_MAX_SIZE:
|
while len(JID_CACHE) > JID_CACHE_MAX_SIZE:
|
||||||
found = None
|
found = None
|
||||||
for key, item in JID_CACHE.items():
|
for key, item in JID_CACHE.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user