mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 23:44:57 -04:00
Fix rare error in ReadWriteLock
when writers complete immediately (#12105)
Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
300ed0b8a6
commit
4d6b6c17c8
3 changed files with 35 additions and 1 deletions
|
@ -555,7 +555,10 @@ class ReadWriteLock:
|
|||
finally:
|
||||
with PreserveLoggingContext():
|
||||
new_defer.callback(None)
|
||||
if self.key_to_current_writer[key] == new_defer:
|
||||
# `self.key_to_current_writer[key]` may be missing if there was another
|
||||
# writer waiting for us and it completed entirely within the
|
||||
# `new_defer.callback()` call above.
|
||||
if self.key_to_current_writer.get(key) == new_defer:
|
||||
self.key_to_current_writer.pop(key)
|
||||
|
||||
return _ctx_manager()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue