-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
@@ -207,6 +213,19 @@ def _process_event_queue_loop(self): | |||
|
|||
self._send_pdu(event, destinations) | |||
|
|||
def handle_room_events(events): | |||
for event in events: | |||
return handle_event(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.
That will handle the first event of events and skip the other events of the queue - even if that first one is valid or not
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.
Good catch
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.
Somewhere on my bike ride to/from the pub on Friday night I realised this was exactly what we needed to do, so thanks for actually doing it.
It's somewhat orthogonal, but it would be nice to report metrics on how far behind the loop is, and throw a Measure in somewhere to get metrics on what it's doing.
], | ||
) | ||
except Exception: | ||
logger.exception("Failed to calculate hosts in room") |
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.
why would this happen?
if we're going to do this, surely we should at least log the event id?
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 shouldn't happen really, but it empirically seems to have on matrix.org in the past so is probably worth keeping for paranoia's sake.
events_by_room.setdefault(event.room_id, []).append(event) | ||
|
||
yield logcontext.make_deferred_yieldable(defer.gatherResults( | ||
[handle_room_events(evs) for evs in events_by_room.itervalues()], |
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.
this looks like it needs a preserve_fn
@@ -226,7 +226,10 @@ def handle_room_events(events): | |||
events_by_room.setdefault(event.room_id, []).append(event) | |||
|
|||
yield logcontext.make_deferred_yieldable(defer.gatherResults( | |||
[handle_room_events(evs) for evs in events_by_room.itervalues()], | |||
[ | |||
logcontext.preserve_fn(handle_room_events)(evs) |
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.
let's not preserve_fn
for every event.. Either preserve_fn once, or use run_in_background
(?)
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.
So do logcontext.run_in_background(handle_room_events(evs))
? Isn't that equivalent to preserve_fn
?
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.
logcontext.run_in_background(handle_room_events, evs)
And yes it is, except that it doesn't create a new function object on each loop.
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.
lgtm
Changes in synapse v0.28.0-rc1 (2018-04-26) =========================================== Bug Fixes: * Fix quarantine media admin API and search reindex (PR #3130) * Fix media admin APIs (PR #3134) Changes in synapse v0.28.0-rc1 (2018-04-24) =========================================== Minor performance improvement to federation sending and bug fixes. (Note: This release does not include state resolutions discussed in matrix live) Features: * Add metrics for event processing lag (PR #3090) * Add metrics for ResponseCache (PR #3092) Changes: * Synapse on PyPy (PR #2760) Thanks to @Valodim! * move handling of auto_join_rooms to RegisterHandler (PR #2996) Thanks to @krombel! * Improve handling of SRV records for federation connections (PR #3016) Thanks to @silkeh! * Document the behaviour of ResponseCache (PR #3059) * Preparation for py3 (PR #3061, #3073, #3074, #3075, #3103, #3104, #3106, #3107, #3109, #3110) Thanks to @NotAFile! * update prometheus dashboard to use new metric names (PR #3069) Thanks to @krombel! * use python3-compatible prints (PR #3074) Thanks to @NotAFile! * Send federation events concurrently (PR #3078) * Limit concurrent event sends for a room (PR #3079) * Improve R30 stat definition (PR #3086) * Send events to ASes concurrently (PR #3088) * Refactor ResponseCache usage (PR #3093) * Clarify that SRV may not point to a CNAME (PR #3100) Thanks to @silkeh! * Use str(e) instead of e.message (PR #3103) Thanks to @NotAFile! * Use six.itervalues in some places (PR #3106) Thanks to @NotAFile! * Refactor store.have_events (PR #3117) Bug Fixes: * Return 401 for invalid access_token on logout (PR #2938) Thanks to @dklug! * Return a 404 rather than a 500 on rejoining empty rooms (PR #3080) * fix federation_domain_whitelist (PR #3099) * Avoid creating events with huge numbers of prev_events (PR #3113) * Reject events which have lots of prev_events (PR #3118)
This also cherry-picks
Handle exceptions in get_hosts_for_room...
from matrix-org-hotfixes