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)
```
This commit is contained in:
Eric Eastwood 2022-07-29 00:16:59 -05:00
parent 1b0840e3aa
commit 1d208fa17e
2 changed files with 7 additions and 7 deletions

View file

@ -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,
}
)

View file

@ -536,7 +536,7 @@ class Notifier:
log_kv(
{
"wait_for_events": "sleep",
"token": prev_token,
"token": str(prev_token),
}
)
@ -546,7 +546,7 @@ class Notifier:
log_kv(
{
"wait_for_events": "woken",
"token": user_stream.current_token,
"token": str(user_stream.current_token),
}
)