This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
There is no retry logic for sending EDUs to application services #11150
Labels
A-Application-Service
Related to AS support
T-Enhancement
New features, changes in functionality, improvements in performance, or user-facing enhancements.
When we send ephemeral events to appservices, we keep track of a stream token per appservice per EDU type. We do this for read receipts and presence updates (but not for typing, those are a little ephemeral to care about).
When a new read receipt comes through the server, we consider whether that should be sent to any connected application services. If so, we send those read receipts off. We then record the stream token of the read receipt for this appservice, even if we ended up determining that the appservice wasn't interested in the event (so that we wouldn't have to check that again later on).
This system works (although has scalability concerns), however there is no retry logic. We record the updated stream token even if sending to the application service fails:
synapse/synapse/handlers/appservice.py
Lines 239 to 245 in e584534
submit_ephemeral_events_for_as
kicks off a background task which logs and then ignores exceptions:synapse/synapse/appservice/scheduler.py
Lines 156 to 159 in 4b965c8
The stream token is stored and updated for this appservice immediately after the background task kicks off. It makes sense to do this so that we do not end up with duplicated work while processing subsequent calls, even if sending to the appservice is slow, however we still need a way of deprecated/holding off updating the stored stream id until a 200 is returned from the appservice. Only then should we mark the appservice as successfully having processed up to that stream token.
This doesn't matter so much with read receipts or presence updates, but will become much more important when we start passing things like device lists over this channel. A blip in the network will lead to decryption errors down the line.
Note that this behaviour for the current set of supported EDUs is intentional:
synapse/synapse/storage/databases/main/appservice.py
Lines 192 to 200 in e584534
The stream tokens are stored in the
application_services_state
table, which has the schema:The text was updated successfully, but these errors were encountered: