summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-07-29 00:16:59 -0500
committerEric Eastwood <erice@element.io>2022-07-29 00:25:03 -0500
commit1d208fa17ec723e1ab324ac1d5cffaf69cae73ef (patch)
treee38afb20f1b811ef999bc51dffc129092c36c3dd /synapse/handlers
parentFix some lints (diff)
downloadsynapse-1d208fa17ec723e1ab324ac1d5cffaf69cae73ef.tar.xz
Fix invalid attribute type
```
Invalid type StreamToken for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
```

Had to add a few more logs to find this instance since the warning doens't give much info where I am setting this invalid attribute.
This was good enough to find it in the code.
```
BoundedAttributes __setitem__ key=since_token value=StreamToken(room_key=RoomStreamToken(topological=None, stream=1787, instance_map=frozendict.frozendict({})), presence_key=481272, typing_key=0, receipt_key=340, account_data_key=1233, push_rules_key=8, to_device_key=57, device_list_key=199, groups_key=0)

BoundedAttributes __setitem__ key=now_token value=StreamToken(room_key=RoomStreamToken(topological=None, stream=1787, instance_map=frozendict.frozendict({})), presence_key=481287, typing_key=0, receipt_key=340, account_data_key=1233, push_rules_key=8, to_device_key=57, device_list_key=199, groups_key=0)

BoundedAttributes __setitem__ key=token value=StreamToken(room_key=RoomStreamToken(topological=None, stream=1787, instance_map=frozendict.frozendict({})), presence_key=481291, typing_key=0, receipt_key=340, account_data_key=1237, push_rules_key=8, to_device_key=57, device_list_key=199, groups_key=0)
```
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/sync.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index ad71feb774..8dc05d648d 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -396,7 +396,7 @@ class SyncHandler:
         indoctrination.
         """
         with start_active_span("sync.current_sync_for_user"):
-            log_kv({"since_token": since_token})
+            log_kv({"since_token": str(since_token)})
             sync_result = await self.generate_sync_result(
                 sync_config, since_token, full_state
             )
@@ -1089,7 +1089,7 @@ class SyncHandler:
         # to query up to a given point.
         # Always use the `now_token` in `SyncResultBuilder`
         now_token = self.event_sources.get_current_token()
-        log_kv({"now_token": now_token})
+        log_kv({"now_token": str(now_token)})
 
         logger.debug(
             "Calculating sync response for %r between %s and %s",
@@ -2007,8 +2007,8 @@ class SyncHandler:
 
             log_kv(
                 {
-                    "since_token": since_token,
-                    "upto_token": upto_token,
+                    "since_token": str(since_token),
+                    "upto_token": str(upto_token),
                 }
             )
 
@@ -2023,7 +2023,7 @@ class SyncHandler:
             log_kv(
                 {
                     "batch_events": len(batch.events),
-                    "prev_batch": batch.prev_batch,
+                    "prev_batch": str(batch.prev_batch),
                     "batch_limited": batch.limited,
                 }
             )