Clean up logging on event persister endpoints (#16488)

This commit is contained in:
Richard van der Hoff 2023-10-14 17:57:27 +01:00 committed by GitHub
parent 166ffc0f23
commit 109882230c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

1
changelog.d/16488.misc Normal file
View File

@ -0,0 +1 @@
Clean up logging on event persister endpoints.

View File

@ -138,7 +138,11 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint):
event_and_contexts.append((event, context)) event_and_contexts.append((event, context))
logger.info("Got %d events from federation", len(event_and_contexts)) logger.info(
"Got batch of %i events to persist to room %s",
len(event_and_contexts),
room_id,
)
max_stream_id = await self.federation_event_handler.persist_events_and_notify( max_stream_id = await self.federation_event_handler.persist_events_and_notify(
room_id, event_and_contexts, backfilled room_id, event_and_contexts, backfilled

View File

@ -118,6 +118,7 @@ class ReplicationSendEventsRestServlet(ReplicationEndpoint):
with Measure(self.clock, "repl_send_events_parse"): with Measure(self.clock, "repl_send_events_parse"):
events_and_context = [] events_and_context = []
events = payload["events"] events = payload["events"]
rooms = set()
for event_payload in events: for event_payload in events:
event_dict = event_payload["event"] event_dict = event_payload["event"]
@ -144,10 +145,12 @@ class ReplicationSendEventsRestServlet(ReplicationEndpoint):
UserID.from_string(u) for u in event_payload["extra_users"] UserID.from_string(u) for u in event_payload["extra_users"]
] ]
# all the rooms *should* be the same, but we'll log separately to be
# sure.
rooms.add(event.room_id)
logger.info( logger.info(
"Got batch of events to send, last ID of batch is: %s, sending into room: %s", "Got batch of %i events to persist to rooms %s", len(events), rooms
event.event_id,
event.room_id,
) )
last_event = ( last_event = (