mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-17 13:23:54 +01:00
Fix error in handling receipts
Fixes an error which has been happening ever since #2158 (v0.21.0-rc1): > TypeError: argument of type 'ObservableDeferred' is not iterable fixes #3234
This commit is contained in:
parent
f8a1e76d64
commit
8b1c856d81
1 changed files with 11 additions and 7 deletions
|
@ -297,18 +297,22 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
||||||
if receipt_type != "m.read":
|
if receipt_type != "m.read":
|
||||||
return
|
return
|
||||||
|
|
||||||
# Returns an ObservableDeferred
|
# Returns either an ObservableDeferred or the raw result
|
||||||
res = self.get_users_with_read_receipts_in_room.cache.get(
|
res = self.get_users_with_read_receipts_in_room.cache.get(
|
||||||
room_id, None, update_metrics=False,
|
room_id, None, update_metrics=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
if res:
|
# first handle the Deferred case
|
||||||
if isinstance(res, defer.Deferred) and res.called:
|
if isinstance(res, defer.Deferred):
|
||||||
|
if res.called:
|
||||||
res = res.result
|
res = res.result
|
||||||
if user_id in res:
|
else:
|
||||||
# We'd only be adding to the set, so no point invalidating if the
|
res = None
|
||||||
# user is already there
|
|
||||||
return
|
if res and user_id in res:
|
||||||
|
# We'd only be adding to the set, so no point invalidating if the
|
||||||
|
# user is already there
|
||||||
|
return
|
||||||
|
|
||||||
self.get_users_with_read_receipts_in_room.invalidate((room_id,))
|
self.get_users_with_read_receipts_in_room.invalidate((room_id,))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue