MatrixSynapse/synapse/util
Richard van der Hoff 13683a3a22
Extend StreamChangeCache to support multiple entities per stream ID (#7303)
First some background: StreamChangeCache is used to keep track of what "entities" have 
changed since a given stream ID. So for example, we might use it to keep track of when the last
to-device message for a given user was received [1], and hence whether we need to pull any to-device messages from the database on a sync [2].

Now, it turns out that StreamChangeCache didn't support more than one thing being changed at
a given stream_id (this was part of the problem with #7206). However, it's entirely valid to send
to-device messages to more than one user at a time.

As it turns out, this did in fact work, because *some* methods of StreamChangeCache coped
ok with having multiple things changing on the same stream ID, and it seems we never actually
use the methods which don't work on the stream change caches where we allow multiple
changes at the same stream ID. But that feels horribly fragile, hence: let's update
StreamChangeCache to properly support this, and add some typing and some more tests while
we're at it.

[1]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L301
[2]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L47-L51
2020-04-22 13:45:40 +01:00
..
caches Extend StreamChangeCache to support multiple entities per stream ID (#7303) 2020-04-22 13:45:40 +01:00
__init__.py move batch_iter to a separate module 2020-01-16 22:25:32 +00:00
async_helpers.py Fix stacktraces when using ObservableDeferred and async/await (#6836) 2020-02-03 17:10:54 +00:00
distributor.py Move logging utilities out of the side drawer of util/ and into logging/ (#5606) 2019-07-04 00:07:04 +10:00
file_consumer.py Move logging utilities out of the side drawer of util/ and into logging/ (#5606) 2019-07-04 00:07:04 +10:00
frozenutils.py Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957) 2020-02-21 07:15:07 -05:00
hash.py Use the v2 Identity Service API for lookups (MSC2134 + MSC2140) (#5976) 2019-09-11 16:02:42 +01:00
httpresourcetree.py Replace instance variations of homeserver with correct case/spacing 2019-11-12 13:08:12 +00:00
iterutils.py Log saml assertions rather than the whole response 2020-01-16 22:26:34 +00:00
jsonobject.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
logcontext.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
logformatter.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
manhole.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
metrics.py Clean up some LoggingContext stuff (#7120) 2020-03-24 14:45:33 +00:00
module_loader.py Handle `config` not being set for synapse plugin modules 2020-01-12 21:34:36 +00:00
msisdn.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
patch_inline_callbacks.py Clean up some LoggingContext stuff (#7120) 2020-03-24 14:45:33 +00:00
ratelimitutils.py Fixes to the federation rate limiter (#5621) 2019-07-05 11:10:19 +01:00
retryutils.py Fix errors storing large retry intervals. 2019-10-02 10:36:27 +01:00
rlimit.py Remove usage of deprecated logger.warn method from codebase (#6271) 2019-10-31 10:23:24 +00:00
stringutils.py Rewrite prune_old_outbound_device_pokes for efficiency (#7159) 2020-03-30 19:06:52 +01:00
threepids.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
versionstring.py Handle FileNotFound error in checking git repository version (#6284) 2019-10-30 11:00:15 +00:00
wheel_timer.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00