Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
bail out early in on_new_receipts if no pushers (#4706)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Feb 21, 2019
1 parent 6d65659 commit 0abb094
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/4706.misc
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
Avoid some redundant work when processing read receipts
8 changes: 8 additions & 0 deletions synapse/push/pusherpool.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def remove_pushers_by_access_token(self, user_id, access_tokens):


@defer.inlineCallbacks @defer.inlineCallbacks
def on_new_notifications(self, min_stream_id, max_stream_id): def on_new_notifications(self, min_stream_id, max_stream_id):
if not self.pushers:
# nothing to do here.
return

try: try:
users_affected = yield self.store.get_push_action_users_in_range( users_affected = yield self.store.get_push_action_users_in_range(
min_stream_id, max_stream_id min_stream_id, max_stream_id
Expand All @@ -155,6 +159,10 @@ def on_new_notifications(self, min_stream_id, max_stream_id):


@defer.inlineCallbacks @defer.inlineCallbacks
def on_new_receipts(self, min_stream_id, max_stream_id, affected_room_ids): def on_new_receipts(self, min_stream_id, max_stream_id, affected_room_ids):
if not self.pushers:
# nothing to do here.
return

try: try:
# Need to subtract 1 from the minimum because the lower bound here # Need to subtract 1 from the minimum because the lower bound here
# is not inclusive # is not inclusive
Expand Down

0 comments on commit 0abb094

Please sign in to comment.