This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add type hints to
synapse/storage/databases/main/account_data.py
#11546Add type hints to
synapse/storage/databases/main/account_data.py
#11546Changes from all commits
71b2ef5
002cb03
91a540d
872f9f5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an iterable over some kind of rowproxy? But it looks like this gets used throughout the inheritance hierarchy in way that makes type checking not feasible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out what the
Any
was supposed to be. For now I've been usingIterable[Any]
for all overrides of this method.I think it's a
Union[any type in Stream.ROW_TYPE]
?synapse/synapse/replication/tcp/streams/_base.py
Line 90 in 3b88722
None of the row types share any fields in common so
Any
orobject
is the best we can do without refactoringThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could make
Stream
generic over its row type? One for another day though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point in the past,
TagsWorkerStore
was split out fromAccountDataWorkerStore
(ca9b9d9). I think this was missed.I left the call to
advance
in, in case we ever instantiate anAccountDataWorkerStore
that is not aTagsWorkerStore
.advance
ought to be idempotent so it should be safe to call it twice.I think we don't need to call
entity_has_changed
here, since it only impacts one spot, which doesn't appear to have anything to do with tags:synapse/synapse/storage/databases/main/account_data.py
Line 326 in 0cc3bf9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say we did instantiate such a store. What does leaving the
advance
call in gain us? It feels a bit odd to have something that looks like it's responding/handling to tag changes, but not really do anything with it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the
advance
,_account_data_id_gen.get_current_token()
would lag behind since it's the minimum stream position across all writers. In the worst case it'd get stuck entirely if there is a writer that only writes tag data.I think the effect of that would be that various bits of Synapse would not get notified about data written after
get_current_token()
, since it can't be sure that all writes had completed. I can't say which bits for sure without doing more digging.