Add some paranoia logging

This commit is contained in:
Erik Johnston 2016-02-11 09:22:37 +00:00
parent 7718303e71
commit a1b7902944

View File

@ -28,6 +28,7 @@ from synapse.api.errors import SynapseError
from ._base import client_v2_patterns from ._base import client_v2_patterns
import copy import copy
import itertools
import logging import logging
import ujson as json import ujson as json
@ -288,6 +289,15 @@ class SyncRestServlet(RestServlet):
state_events = state_dict.values() state_events = state_dict.values()
for event in itertools.chain(state_events, timeline_events):
# We've had bug reports that events were coming down under the
# wrong room.
if event.room_id != room.room_id:
logger.warn(
"Event %r is under room %r instead of %r",
event.event_id, room.room_id, event.room_id,
)
serialized_state = [serialize(e) for e in state_events] serialized_state = [serialize(e) for e in state_events]
serialized_timeline = [serialize(e) for e in timeline_events] serialized_timeline = [serialize(e) for e in timeline_events]