mirror of
https://github.com/element-hq/synapse.git
synced 2026-01-16 23:00:43 +00:00
Expose the sticky event TTL to clients
This commit is contained in:
parent
42fa925e79
commit
b2d83e6b85
1 changed files with 9 additions and 0 deletions
|
|
@ -237,6 +237,15 @@ async def filter_and_transform_events_for_client(
|
|||
# to the cache!
|
||||
cloned = clone_event(filtered)
|
||||
cloned.unsigned[EventUnsignedContentFields.MEMBERSHIP] = user_membership
|
||||
if storage.main.config.experimental.msc4354_enabled:
|
||||
sticky_duration = cloned.sticky_duration()
|
||||
if sticky_duration:
|
||||
now = storage.main.clock.time_msec()
|
||||
expires_at = min(cloned.origin_server_ts, now) + sticky_duration
|
||||
if expires_at > now:
|
||||
cloned.unsigned[EventUnsignedContentFields.STICKY_TTL] = (
|
||||
expires_at - now
|
||||
)
|
||||
|
||||
return cloned
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue