Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Clean up logging on event persister endpoints (#16488)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh authored Oct 14, 2023
1 parent 166ffc0 commit 1098822
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/16488.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clean up logging on event persister endpoints.
6 changes: 5 additions & 1 deletion synapse/replication/http/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ async def _handle_request(self, request: Request, content: JsonDict) -> Tuple[in

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(
room_id, event_and_contexts, backfilled
Expand Down
13 changes: 8 additions & 5 deletions synapse/replication/http/send_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ async def _handle_request( # type: ignore[override]
with Measure(self.clock, "repl_send_events_parse"):
events_and_context = []
events = payload["events"]
rooms = set()

for event_payload in events:
event_dict = event_payload["event"]
Expand All @@ -144,11 +145,13 @@ async def _handle_request( # type: ignore[override]
UserID.from_string(u) for u in event_payload["extra_users"]
]

logger.info(
"Got batch of events to send, last ID of batch is: %s, sending into room: %s",
event.event_id,
event.room_id,
)
# all the rooms *should* be the same, but we'll log separately to be
# sure.
rooms.add(event.room_id)

logger.info(
"Got batch of %i events to persist to rooms %s", len(events), rooms
)

last_event = (
await self.event_creation_handler.persist_and_notify_client_events(
Expand Down

0 comments on commit 1098822

Please sign in to comment.