This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Split presence out of master #9820
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6faecec
Make presence writer instance configurable
erikjohnston 73c9c4f
Allow PresenceStore to be instansiated on workers
erikjohnston 7bb21f8
Register presence api endpoints on workers
erikjohnston 05a55f5
Newsfile
erikjohnston ce794bf
Merge stub presence servlet into real servlet.
erikjohnston 1f7c743
Comments
erikjohnston 7072a29
Remove duplicate _can_persist_presence
erikjohnston 72ca4cb
Add sequence to port DB script
erikjohnston 791e3b3
Apply suggestions from code review
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,15 +272,22 @@ class PresenceStream(Stream): | |
NAME = "presence" | ||
ROW_TYPE = PresenceStreamRow | ||
|
||
def __init__(self, hs): | ||
def __init__(self, hs: "HomeServer"): | ||
store = hs.get_datastore() | ||
|
||
if hs.config.worker_app is None: | ||
# on the master, query the presence handler | ||
if hs.get_instance_name() in hs.config.worker.writers.presence: | ||
# on the presence writer, query the presence handler | ||
presence_handler = hs.get_presence_handler() | ||
update_function = presence_handler.get_all_presence_updates | ||
|
||
from synapse.handlers.presence import PresenceHandler | ||
|
||
assert isinstance(presence_handler, PresenceHandler) | ||
|
||
update_function = ( | ||
presence_handler.get_all_presence_updates | ||
) # type: UpdateFunction | ||
else: | ||
# Query master process | ||
# Query presence writer process | ||
update_function = make_http_update_function(hs, self.NAME) | ||
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. doesn't this need directing to the presence writer? 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. The |
||
|
||
super().__init__( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
looks like each of these can be a list of instances?
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.
well, apparently it's a single-element list, but you should probably say that.
(why are these different to
typing
?)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.
Err, good Q. I think there are two options here: 1) make the single item lists just be strings, or 2) make typing be a single item list. I'm tempted to go with the latter so everything is consistent, but the former may be a bit less confusing.
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.
making typing a single-item list sounds fine to me.