summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-04-30 18:40:33 +0200
committermathieui <mathieui@mathieui.net>2021-04-30 19:27:30 +0200
commit0b5f6cb0a8e86c2e0b76d5f7ba1ae4f2ad801ebc (patch)
tree5ccb0ff35a5ffabb1169c8b06c5f93d08d286005
parent027545eb710c6a760a4ddc1f7ce6c193a47b1cec (diff)
downloadslixmpp-0b5f6cb0a8e86c2e0b76d5f7ba1ae4f2ad801ebc.tar.gz
slixmpp-0b5f6cb0a8e86c2e0b76d5f7ba1ae4f2ad801ebc.tar.bz2
slixmpp-0b5f6cb0a8e86c2e0b76d5f7ba1ae4f2ad801ebc.tar.xz
slixmpp-0b5f6cb0a8e86c2e0b76d5f7ba1ae4f2ad801ebc.zip
xmlstream: fix slow tasks scheduling
- wrong attribute used - some mistakes in the slow tasks function
-rw-r--r--slixmpp/xmlstream/xmlstream.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index 7a94bf50..ab9b781d 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -1053,11 +1053,13 @@ class XMLStream(asyncio.BaseProtocol):
"""
data = await task
self.__slow_tasks.remove(task)
- for filter in self.__filters['out']:
+ if data is None:
+ return
+ for filter in self.__filters['out'][:]:
if filter in already_used:
continue
if iscoroutinefunction(filter):
- data = await task
+ data = await filter(data)
else:
data = filter(data)
if data is None:
@@ -1093,7 +1095,7 @@ class XMLStream(asyncio.BaseProtocol):
timeout=1,
)
if pending:
- self.slow_tasks.append(task)
+ self.__slow_tasks.append(task)
asyncio.ensure_future(
self._continue_slow_send(
task,
@@ -1101,7 +1103,9 @@ class XMLStream(asyncio.BaseProtocol):
),
loop=self.loop,
)
- raise Exception("Slow coro, rescheduling")
+ raise ContinueQueue(
+ "Slow coroutine, rescheduling filters"
+ )
data = task.result()
else:
data = filter(data)