-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix appservices being backlogged and not receiving new events due to a bug in notify_interested_services #2631
Fix appservices being backlogged and not receiving new events due to a bug in notify_interested_services #2631
Conversation
…a bug in notify_interested_services
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
the test infloops because it's made to always return a single event edit: I fixed it in the commit below |
cc2b1e3
to
8a4a0dd
Compare
@xyzz - thanks for this; it looks like a pretty plausible bug & fix. @erikjohnston can you review it (when back from hol) please? |
@matrixbot ok to test |
Woo, thanks.
I imagine this happens when
@xyzz any thoughts? |
@@ -74,7 +74,7 @@ def notify_interested_services(self, current_id): | |||
limit = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would help avoid confusion if upper_bound = self.current_max
above this line was removed
I like current solution better because there's less code to maintain. Is there any benefit to checking len of returned events? I removed the assignment as you suggested. |
Cool, thanks! :) |
The bug is:
get_new_events_for_appservice
returns max(event_id) for all retrieved rowsget_new_events_for_appservice
accepts upper_bound and all retrieved rows have event_id <= upper_boundnotify_interested_services
sets upper_bound to whateverget_new_events_for_appservice
returned, what happens is thewhile True
loop at line 75 is executed only once when your server has more than 100 events: first, it gets 100events
, the next iteration it will always get 0I saw this happen on my homeserver.
Changing it to
current_max
ensures that it always gets some events, until the backlog is clear.The second change is removing the
len(events) < limit
check - I'm not sure why, but sometimes it returned 99 events for me, even while there were a lot of events backlogged. Since there's another check:if not events
, this should not make things infloop.Signed-off-by: Ilya Zhuravlev whatever@xyz.is