-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Implement MSC3944 to delete stale to-device messages #16082
Comments
The proposed rules for when to delete stale messages generally fall into 3 categories:
Unfortunately the fields we're searching on aren't exposed in the database as separate columns. We'll want to handle this for both newly received to-device messages as well as for any old messages that might currently exist in the database. |
#15842 attempts to do this when a user uploads new to-device messages, I think this has a couple of issues:
Another approach might be to run a background loop that handles the to-device stream to handle stale messages. (This is siilar to how we do the |
related: #3599 |
+1 for the background loop - that seems reasonable. |
There's a race we need to be careful to consider here:
Do we care about this race? It feels like its no worse than the existing race where a client receives the cancellation after its already processed it? We could keep track of which rows we've already sent down to clients, but that feels like extra bookkeeping i'd rather avoid. Separately, I think we need to flesh out what the background job actually looks like in practice, as we'd need to track data (such as in flight requests) and where do we store it? It might be easier if we extend the table to pull out some of the information in the JSON so that we can efficiently look up key requests by request ID? Making it easier to handle cancellations? For verification requests we would want a received timestamp? We could also put these in a separate table? |
I think from the server's POV we can't tell if we've only sent things to a client or if they've actually processed them, so we just might not care?
I think we probably do, but for an initial version I was going to pull the fields out of JSON. (It might not be able to land this way, but I think it'll let us get the rest of the mechanics down.) |
MSC3944 defines some conditions where it is safe to delete "stale" to-device messages. See the MSC for specifics on when this is true.
See #15842 for a potential implementation.
This will help with #3599, but it is unclear how much.
The text was updated successfully, but these errors were encountered: