diff options
author | mathieui <mathieui@mathieui.net> | 2021-04-30 18:40:33 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-04-30 18:51:07 +0200 |
commit | 8b90cdd73f392d9e6aba3a15d2b3df9b4d70f336 (patch) | |
tree | cdcb780a6ead957f7aa77214b915d9efa392992a | |
parent | ee671dfb294e3615e42f3f407b6ab2c4df698a98 (diff) | |
download | slixmpp-8b90cdd73f392d9e6aba3a15d2b3df9b4d70f336.tar.gz slixmpp-8b90cdd73f392d9e6aba3a15d2b3df9b4d70f336.tar.bz2 slixmpp-8b90cdd73f392d9e6aba3a15d2b3df9b4d70f336.tar.xz slixmpp-8b90cdd73f392d9e6aba3a15d2b3df9b4d70f336.zip |
xmlstream: fix slow tasks scheduling
- wrong attribute used
- some mistakes in the slow tasks function
-rw-r--r-- | slixmpp/xmlstream/xmlstream.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 5074aa8c..b5b78b31 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -1007,11 +1007,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: @@ -1047,7 +1049,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, @@ -1055,7 +1057,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) |