add event id to logcontext when handling incoming PDUs (#10936)

pull/10967/head
Richard van der Hoff 2021-09-29 11:59:43 +01:00 committed by GitHub
parent 94b620a5ed
commit 176aa55fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

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

@ -0,0 +1 @@
Include the event id in the logcontext when handling PDUs received over federation.

View File

@ -1008,7 +1008,10 @@ class FederationServer(FederationBase):
async with lock:
logger.info("handling received PDU: %s", event)
try:
await self._federation_event_handler.on_receive_pdu(origin, event)
with nested_logging_context(event.event_id):
await self._federation_event_handler.on_receive_pdu(
origin, event
)
except FederationError as e:
# XXX: Ideally we'd inform the remote we failed to process
# the event, but we can't return an error in the transaction