mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
Fix "argument of type 'ObservableDeferred' is not iterable" error (#7708)
This commit is contained in:
parent
5c5516f80e
commit
231252516c
3 changed files with 7 additions and 5 deletions
1
changelog.d/7708.bugfix
Normal file
1
changelog.d/7708.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fixs a long standing bug which resulted in an exception: "TypeError: argument of type 'ObservableDeferred' is not iterable".
|
|
@ -24,6 +24,7 @@ from twisted.internet import defer
|
||||||
from synapse.storage._base import SQLBaseStore, make_in_list_sql_clause
|
from synapse.storage._base import SQLBaseStore, make_in_list_sql_clause
|
||||||
from synapse.storage.database import Database
|
from synapse.storage.database import Database
|
||||||
from synapse.storage.util.id_generators import StreamIdGenerator
|
from synapse.storage.util.id_generators import StreamIdGenerator
|
||||||
|
from synapse.util.async_helpers import ObservableDeferred
|
||||||
from synapse.util.caches.descriptors import cached, cachedInlineCallbacks, cachedList
|
from synapse.util.caches.descriptors import cached, cachedInlineCallbacks, cachedList
|
||||||
from synapse.util.caches.stream_change_cache import StreamChangeCache
|
from synapse.util.caches.stream_change_cache import StreamChangeCache
|
||||||
|
|
||||||
|
@ -300,10 +301,10 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
||||||
room_id, None, update_metrics=False
|
room_id, None, update_metrics=False
|
||||||
)
|
)
|
||||||
|
|
||||||
# first handle the Deferred case
|
# first handle the ObservableDeferred case
|
||||||
if isinstance(res, defer.Deferred):
|
if isinstance(res, ObservableDeferred):
|
||||||
if res.called:
|
if res.has_called():
|
||||||
res = res.result
|
res = res.get_result()
|
||||||
else:
|
else:
|
||||||
res = None
|
res = None
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class ObservableDeferred(object):
|
||||||
|
|
||||||
This returns a brand new deferred that is resolved when the underlying
|
This returns a brand new deferred that is resolved when the underlying
|
||||||
deferred is resolved. Interacting with the returned deferred does not
|
deferred is resolved. Interacting with the returned deferred does not
|
||||||
effect the underdlying deferred.
|
effect the underlying deferred.
|
||||||
"""
|
"""
|
||||||
if not self._result:
|
if not self._result:
|
||||||
d = defer.Deferred()
|
d = defer.Deferred()
|
||||||
|
|
Loading…
Reference in a new issue