-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Split event creation into a separate handler #2847
Conversation
@matrixbot retest this please |
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.
probably ought to update the copyright on some of these files
synapse/handlers/message.py
Outdated
} | ||
for user_id, profile in users_with_profile.iteritems() | ||
}) | ||
|
||
@measure_func("_create_new_client_event") | ||
@defer.inlineCallbacks | ||
def _create_new_client_event(self, builder, requester=None, prev_event_ids=None): |
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.
if we're moving this anyway, and it's intended to be called from outside the handler, please can we drop the leading _
?
self.ratelimiter = hs.get_ratelimiter() | ||
self.notifier = hs.get_notifier() | ||
|
||
# This is only used to get at ratelimit function, and maybe_kick_guest_users |
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 kinda wish it wish they were factored out, but I guess that is a problem for another time
|
||
class EventCreationHandler(object): | ||
def __init__(self, hs): | ||
self.hs = hs |
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.
it'd be nice if all these private fields were named with a leading underscore, but I suppose that increases the diff significantly?
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.
Its doable, but the diff would be quite big
@@ -378,7 +378,7 @@ def create_event(self, requester, event_dict, token_id=None, txn_id=None, | |||
if txn_id is not None: | |||
builder.internal_metadata.txn_id = txn_id | |||
|
|||
event, context = yield self._create_new_client_event( | |||
event, context = yield self.create_new_client_event( |
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.
yeah, you see you made the mistake of expecting the thing that is named like a private field to not be gut-wrenched across the codebase.
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.
oh, no you didn't. you just did the other changes in a commit called "Update copyright" which ... I didn't expect.
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.
Oh, blast, I think that might have been vscode doing the changes without saving the open files. Sigh.
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 have unfucked it now.
b165e0f
to
3e1e69c
Compare
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 plausible!
No description provided.