mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
Don't bother proxying lookups on _NotificationListener to underlying deferred
This commit is contained in:
parent
22049ea700
commit
1f24c2e589
1 changed files with 2 additions and 10 deletions
|
@ -48,13 +48,7 @@ class _NotificationListener(object):
|
||||||
__slots__ = ["deferred"]
|
__slots__ = ["deferred"]
|
||||||
|
|
||||||
def __init__(self, deferred):
|
def __init__(self, deferred):
|
||||||
object.__setattr__(self, "deferred", deferred)
|
self.deferred = deferred
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return getattr(self.deferred, name)
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
setattr(self.deferred, name, value)
|
|
||||||
|
|
||||||
|
|
||||||
class _NotifierUserStream(object):
|
class _NotifierUserStream(object):
|
||||||
|
@ -313,14 +307,12 @@ class Notifier(object):
|
||||||
if timeout:
|
if timeout:
|
||||||
listener = None
|
listener = None
|
||||||
timer = self.clock.call_later(
|
timer = self.clock.call_later(
|
||||||
timeout/1000., lambda: listener.cancel()
|
timeout/1000., lambda: listener.deferred.cancel()
|
||||||
)
|
)
|
||||||
|
|
||||||
prev_token = from_token
|
prev_token = from_token
|
||||||
while not result:
|
while not result:
|
||||||
try:
|
try:
|
||||||
# We need to start listening to the streams *before* doing
|
|
||||||
# the callback, as otherwise we may miss something.
|
|
||||||
current_token = user_stream.current_token
|
current_token = user_stream.current_token
|
||||||
|
|
||||||
result = yield callback(prev_token, current_token)
|
result = yield callback(prev_token, current_token)
|
||||||
|
|
Loading…
Reference in a new issue