mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 19:57:45 +00:00
Part of: MSC4354 (Experimental Feature tracking issue #19409) Follows: #20312 (which plumbs `received_ts` into the `Event` struct, allowing us to calculate this correctly and sanely) - When writing to `sticky_events`, we now use the `received_ts` stamped onto the event to calculate the expiry, rather than taking a second clock reading. - When emitting the `unsigned.sticky_duration_remaining_ms` (currently called `unsigned.msc4354_sticky_duration_ttl_ms`) field, we now also use the `received_ts` as a clamp on the start of the stickiness, causing us to calculate the same expiry timestamp as the one saved to `sticky_events` (**This is a bugfix, as previously we weren't using `received_ts` here like the MSC requires.**) - The calculation of the expiry is centralised into the `Event` struct, which I hope you'll agree is a huge sanity improvement. - We now systematically prevent spammy or rejected events from counting as sticky. --------- Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org> Co-authored-by: Erik Johnston <erikj@element.io>