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

Commit

Permalink
Merge pull request #854 from matrix-org/erikj/federation_logging
Browse files Browse the repository at this point in the history
Add some logging for when servers ask for missing events
  • Loading branch information
erikjohnston committed Jun 8, 2016
2 parents 128360d + 17aab58 commit 746b2f5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,20 @@ def on_claim_client_keys(self, origin, content):
@log_function
def on_get_missing_events(self, origin, room_id, earliest_events,
latest_events, limit, min_depth):
logger.info(
"on_get_missing_events: earliest_events: %r, latest_events: %r,"
" limit: %d, min_depth: %d",
earliest_events, latest_events, limit, min_depth
)
missing_events = yield self.handler.on_get_missing_events(
origin, room_id, earliest_events, latest_events, limit, min_depth
)

if len(missing_events) < 5:
logger.info("Returning %d events: %r", len(missing_events), missing_events)
else:
logger.info("Returning %d events", len(missing_events))

time_now = self._clock.time_msec()

defer.returnValue({
Expand Down Expand Up @@ -490,6 +500,11 @@ def _handle_new_pdu(self, origin, pdu, get_missing=True):
latest = set(latest)
latest |= seen

logger.info(
"Missing %d events for room %r: %r...",
len(prevs - seen), pdu.room_id, list(prevs - seen)[:5]
)

missing_events = yield self.get_missing_events(
origin,
pdu.room_id,
Expand Down Expand Up @@ -517,6 +532,10 @@ def _handle_new_pdu(self, origin, pdu, get_missing=True):
prevs = {e_id for e_id, _ in pdu.prev_events}
seen = set(have_seen.keys())
if prevs - seen:
logger.info(
"Still missing %d events for room %r: %r...",
len(prevs - seen), pdu.room_id, list(prevs - seen)[:5]
)
fetch_state = True

if fetch_state:
Expand Down

0 comments on commit 746b2f5

Please sign in to comment.