xmlstream: fix slow tasks scheduling
- wrong attribute used - some mistakes in the slow tasks function
This commit is contained in:
parent
027545eb71
commit
0b5f6cb0a8
1 changed files with 8 additions and 4 deletions
|
@ -1053,11 +1053,13 @@ class XMLStream(asyncio.BaseProtocol):
|
||||||
"""
|
"""
|
||||||
data = await task
|
data = await task
|
||||||
self.__slow_tasks.remove(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:
|
if filter in already_used:
|
||||||
continue
|
continue
|
||||||
if iscoroutinefunction(filter):
|
if iscoroutinefunction(filter):
|
||||||
data = await task
|
data = await filter(data)
|
||||||
else:
|
else:
|
||||||
data = filter(data)
|
data = filter(data)
|
||||||
if data is None:
|
if data is None:
|
||||||
|
@ -1093,7 +1095,7 @@ class XMLStream(asyncio.BaseProtocol):
|
||||||
timeout=1,
|
timeout=1,
|
||||||
)
|
)
|
||||||
if pending:
|
if pending:
|
||||||
self.slow_tasks.append(task)
|
self.__slow_tasks.append(task)
|
||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
self._continue_slow_send(
|
self._continue_slow_send(
|
||||||
task,
|
task,
|
||||||
|
@ -1101,7 +1103,9 @@ class XMLStream(asyncio.BaseProtocol):
|
||||||
),
|
),
|
||||||
loop=self.loop,
|
loop=self.loop,
|
||||||
)
|
)
|
||||||
raise Exception("Slow coro, rescheduling")
|
raise ContinueQueue(
|
||||||
|
"Slow coroutine, rescheduling filters"
|
||||||
|
)
|
||||||
data = task.result()
|
data = task.result()
|
||||||
else:
|
else:
|
||||||
data = filter(data)
|
data = filter(data)
|
||||||
|
|
Loading…
Reference in a new issue