-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Process previously failed backfill events in the background #15585
Process previously failed backfill events in the background #15585
Conversation
…vents-in-background
This function is used for backfill and when another server sends us a PDU. In either case, we're trying to avoid the costly state calculations to see if it's allowed so I think we should always do this check See #15585 (comment)
To avoid events stacking up in parallel exhausting our resources. See #15585 (comment)
…vents-in-background
…vents-in-background Conflicts: synapse/handlers/federation_event.py
Co-authored-by: Patrick Cloke <[email protected]>
Since we only use the result from `get_event_ids_with_failed_pull_attempts(...)` in lookups, we don't need to care about the order. See: - #15585 (comment) - #15585 (comment)
…ssed even if it is in the background See #15585 (comment)
# Ensure `run_as_background_process(...)` has a chance to run (essentially | ||
# `wait_for_background_processes()`) | ||
self.reactor.pump((0.1,)) |
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.
Continuing from previous comment,
The test passes even without this pump()
. I'm uncertain about the exact intricacies and details of run_as_background_process(...)
that allow it to pass. It is possible that the test passes due to its time-sensitive nature, and without the pump()
, it might become flakey. However, these are merely theoretical assumptions.
But I want to ensure that this test is robust to any work that may happen in run_as_background_process(...)
in the future. Ideally, we would have an idiomatic wait_for_background_processes()
that would indicate clear intentions and handle the complexity of whatever waiting is necessary.
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.
Looks good! Thanks for working through it with me.
Although I see now that CI is unhappy... |
…vents-in-background
Thanks for the review and extra push today @clokep to get this across the line 🦮 |
Process previously failed backfill events in the background because they are bound to fail again and we don't need to waste time holding up the request for something that is bound to fail again.
Fix #13623
Follow-up to #13621 and #13622
Part of making
/messages
faster: #13356For example, in this
/messages
request, this PR would have saved 15s because the event being processed by the_process_pulled_event
with a ❗ has already failed 4 times previously and we would just process it in the background.Full Jaeger trace JSON
Dev notes
Testing:
Related PRs
prev_events
after we already know their signature is invalid #13816Todo
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.Pull request includes a sign off(run the linters)