Add some debug logging for device list handling
parent
fde26e47d6
commit
c633fc02d7
|
@ -402,6 +402,12 @@ class DeviceHandler(DeviceWorkerHandler):
|
||||||
user_id, device_ids, list(hosts)
|
user_id, device_ids, list(hosts)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for device_id in device_ids:
|
||||||
|
logger.debug(
|
||||||
|
"Notifying about update %r/%r, ID: %r", user_id, device_id,
|
||||||
|
position,
|
||||||
|
)
|
||||||
|
|
||||||
room_ids = yield self.store.get_rooms_for_user(user_id)
|
room_ids = yield self.store.get_rooms_for_user(user_id)
|
||||||
|
|
||||||
yield self.notifier.on_new_event(
|
yield self.notifier.on_new_event(
|
||||||
|
@ -409,7 +415,7 @@ class DeviceHandler(DeviceWorkerHandler):
|
||||||
)
|
)
|
||||||
|
|
||||||
if hosts:
|
if hosts:
|
||||||
logger.info("Sending device list update notif to: %r", hosts)
|
logger.info("Sending device list update notif for %r to: %r", user_id, hosts)
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
self.federation_sender.send_device_messages(host)
|
self.federation_sender.send_device_messages(host)
|
||||||
|
|
||||||
|
@ -479,15 +485,26 @@ class DeviceListEduUpdater(object):
|
||||||
|
|
||||||
if get_domain_from_id(user_id) != origin:
|
if get_domain_from_id(user_id) != origin:
|
||||||
# TODO: Raise?
|
# TODO: Raise?
|
||||||
logger.warning("Got device list update edu for %r from %r", user_id, origin)
|
logger.warning(
|
||||||
|
"Got device list update edu for %r/%r from %r",
|
||||||
|
user_id, device_id, origin,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
room_ids = yield self.store.get_rooms_for_user(user_id)
|
room_ids = yield self.store.get_rooms_for_user(user_id)
|
||||||
if not room_ids:
|
if not room_ids:
|
||||||
# We don't share any rooms with this user. Ignore update, as we
|
# We don't share any rooms with this user. Ignore update, as we
|
||||||
# probably won't get any further updates.
|
# probably won't get any further updates.
|
||||||
|
logger.warning(
|
||||||
|
"Got device list update edu for %r/%r, but don't share a room",
|
||||||
|
user_id, device_id,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Received device list update for %r/%r", user_id, device_id,
|
||||||
|
)
|
||||||
|
|
||||||
self._pending_updates.setdefault(user_id, []).append(
|
self._pending_updates.setdefault(user_id, []).append(
|
||||||
(device_id, stream_id, prev_ids, edu_content)
|
(device_id, stream_id, prev_ids, edu_content)
|
||||||
)
|
)
|
||||||
|
@ -505,10 +522,18 @@ class DeviceListEduUpdater(object):
|
||||||
# This can happen since we batch updates
|
# This can happen since we batch updates
|
||||||
return
|
return
|
||||||
|
|
||||||
|
for device_id, stream_id, prev_ids, content in pending_updates:
|
||||||
|
logger.debug(
|
||||||
|
"Handling update %r/%r, ID: %r, prev: %r ",
|
||||||
|
user_id, device_id, stream_id, prev_ids,
|
||||||
|
)
|
||||||
|
|
||||||
# Given a list of updates we check if we need to resync. This
|
# Given a list of updates we check if we need to resync. This
|
||||||
# happens if we've missed updates.
|
# happens if we've missed updates.
|
||||||
resync = yield self._need_to_do_resync(user_id, pending_updates)
|
resync = yield self._need_to_do_resync(user_id, pending_updates)
|
||||||
|
|
||||||
|
logger.debug("Need to re-sync devices for %r? %r", user_id, resync)
|
||||||
|
|
||||||
if resync:
|
if resync:
|
||||||
# Fetch all devices for the user.
|
# Fetch all devices for the user.
|
||||||
origin = get_domain_from_id(user_id)
|
origin = get_domain_from_id(user_id)
|
||||||
|
@ -561,6 +586,12 @@ class DeviceListEduUpdater(object):
|
||||||
)
|
)
|
||||||
devices = []
|
devices = []
|
||||||
|
|
||||||
|
for device in devices:
|
||||||
|
logger.debug(
|
||||||
|
"Handling resync update %r/%r, ID: %r",
|
||||||
|
user_id, device["device_id"], stream_id,
|
||||||
|
)
|
||||||
|
|
||||||
yield self.store.update_remote_device_list_cache(
|
yield self.store.update_remote_device_list_cache(
|
||||||
user_id, devices, stream_id,
|
user_id, devices, stream_id,
|
||||||
)
|
)
|
||||||
|
@ -593,6 +624,11 @@ class DeviceListEduUpdater(object):
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Current extremity for %r: %r",
|
||||||
|
user_id, extremity,
|
||||||
|
)
|
||||||
|
|
||||||
stream_id_in_updates = set() # stream_ids in updates list
|
stream_id_in_updates = set() # stream_ids in updates list
|
||||||
for _, stream_id, prev_ids, _ in updates:
|
for _, stream_id, prev_ids, _ in updates:
|
||||||
if not prev_ids:
|
if not prev_ids:
|
||||||
|
|
Loading…
Reference in New Issue