-
Notifications
You must be signed in to change notification settings - Fork 435
MSC4354: Sticky Events #18968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
MSC4354: Sticky Events #18968
Changes from all commits
abf658c
8699534
7801e68
e01a22b
3e7a5a6
7af7429
0cfdd0d
7c8daf4
ac0f8c2
1e812e4
2728b21
666e94b
771692a
ad6a2b9
33d80be
148caef
de3e9b4
105d2cd
651e829
4acc98d
78c4097
15453d4
aa45bf7
888ab79
aac3c84
075312c
7f1e057
58bf128
686ce52
4def404
adb601b
b1af5fe
f0689ce
b2c967f
4d02a4c
a4cac85
9016d68
dcb7678
1f077a5
aea2595
e9773ff
67a1af4
fd8d0dd
155ea24
55727c7
df3d2aa
38f5dad
c90dd64
8b08b1f
e1b6eab
0ea82c5
6522c3e
6e874a9
f86d9f8
d7092a3
375ebb5
ad3d66f
11472bb
99cfd75
59b9f97
f056f2d
36ccb90
4fb1c5a
683ef01
bbb06bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Implement support for MSC4354: Sticky Events. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,7 @@ def __init__( | |
| self._instance_name = hs.get_instance_name() | ||
| self._federation_shard_config = hs.config.worker.federation_shard_config | ||
| self._state = hs.get_state_handler() | ||
| self._msc4354_enabled = hs.config.experimental.msc4354_enabled | ||
|
|
||
| self._should_send_on_this_instance = True | ||
| if not self._federation_shard_config.should_handle( | ||
|
|
@@ -583,6 +584,33 @@ async def _catch_up_transmission_loop(self) -> None: | |
| # send. | ||
| extrem_events = await self._store.get_events_as_list(extrems) | ||
|
|
||
| if self._msc4354_enabled: | ||
| # we also want to send sticky events that are still active in this room | ||
| sticky_event_ids = ( | ||
| await self._store.get_sticky_event_ids_sent_by_self( | ||
| pdu.room_id, | ||
| last_successful_stream_ordering, | ||
| ) | ||
| ) | ||
| # skip any that are actually the forward extremities we want to send anyway | ||
| sticky_events = await self._store.get_events_as_list( | ||
| [ | ||
| event_id | ||
| for event_id in sticky_event_ids | ||
| if event_id not in extrems | ||
| ] | ||
| ) | ||
| if sticky_events: | ||
| # *prepend* these to the extrem list, so they are processed first. | ||
| # This ensures they will show up before the forward extrem in stream order | ||
| extrem_events = sticky_events + extrem_events | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, |
||
| logger.info( | ||
| "Sending %d missed sticky events to %s: %r", | ||
| len(sticky_events), | ||
| self._destination, | ||
| pdu.room_id, | ||
| ) | ||
|
|
||
| new_pdus = [] | ||
| for p in extrem_events: | ||
| # We pulled this from the DB, so it'll be non-null | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. underneath this section, we filter out events that happened before the remote went offline. I'm not convinced this will reliably send sticky events to remotes that recently joined a room. |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.