element-hq / element-hq/synapse

The `new_token` parameter of `Notifier.on_new_event` seems to be misunderstood

Open
#19,969 0 comments 0 reactions 1 assignee Claimed by @reivilibre View on GitHub
A-Workers T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

[`Notifier.on_new_event`](https://github.com/element-hq/synapse/blob/5ed830b3b4c74c89d876cc07756c5d98a100cbed/synapse/notifier.py#L500-L554) has a `new_token` parameter.

To me, it looks like that's supposed to get the stream's new position passed (as you'd get from `.get_current_token()` on an ID generator).

In actuality, for some stream types (e.g. thread subscriptions), we are passing the `stream_id` from newly-inserted rows. In a multi-writer setup, new rows don't immediately become the current stream position.

It seems it only matters for a small handful of stream types, so the relatively-new streams getting this wrong might not have any real issues from this misunderstanding.

- [ ] identify and fix up the mistakes
- [ ] there might be documentation to correct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.