mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-27 08:09:44 -05:00
Don't bother checking for new events from a source if the stream token hasn't advanced for that source
This commit is contained in:
parent
63878c0379
commit
df6db5c802
@ -294,7 +294,7 @@ class Notifier(object):
|
|||||||
def _timeout_listener():
|
def _timeout_listener():
|
||||||
timed_out[0] = True
|
timed_out[0] = True
|
||||||
timer[0] = None
|
timer[0] = None
|
||||||
listener[0].notify(user_stream)
|
listener[0].notify(from_token)
|
||||||
|
|
||||||
# We create multiple notification listeners so we have to manage
|
# We create multiple notification listeners so we have to manage
|
||||||
# canceling the timeout ourselves.
|
# canceling the timeout ourselves.
|
||||||
@ -329,11 +329,15 @@ class Notifier(object):
|
|||||||
limit = pagination_config.limit
|
limit = pagination_config.limit
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def check_for_updates(start_token, end_token):
|
def check_for_updates(before_token, after_token):
|
||||||
events = []
|
events = []
|
||||||
end_token = from_token
|
end_token = from_token
|
||||||
for name, source in self.event_sources.sources.items():
|
for name, source in self.event_sources.sources.items():
|
||||||
keyname = "%s_key" % name
|
keyname = "%s_key" % name
|
||||||
|
before_id = getattr(before_token, keyname)
|
||||||
|
after_id = getattr(after_token, keyname)
|
||||||
|
if before_id == after_id:
|
||||||
|
continue
|
||||||
stuff, new_key = yield source.get_new_events_for_user(
|
stuff, new_key = yield source.get_new_events_for_user(
|
||||||
user, getattr(from_token, keyname), limit,
|
user, getattr(from_token, keyname), limit,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user