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,11 +145,13 @@ 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"]
] ]
logger.info( # all the rooms *should* be the same, but we'll log separately to be
"Got batch of events to send, last ID of batch is: %s, sending into room: %s", # sure.
event.event_id, rooms.add(event.room_id)
event.room_id,
) logger.info(
"Got batch of %i events to persist to rooms %s", len(events), rooms
)
last_event = ( last_event = (
await self.event_creation_handler.persist_and_notify_client_events( await self.event_creation_handler.persist_and_notify_client_events(