You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A way to work around this issue is to create a task that runs the coroutine. Modifying the update method of the Sink class to return a task fixes the issue. The tests in tests/core.py continue pass.
diff --git a/streamz/core.py b/streamz/core.py
index fe588ed..6916f19 100644
--- a/streamz/core.py
+++ b/streamz/core.py
@@ -535,7 +535,7 @@ class sink(Stream):
def update(self, x, who=None):
result = self.func(x, *self.args, **self.kwargs)
if gen.isawaitable(result):
- return result
+ return gen.convert_yielded(result)
else:
return []
I'm quite sure this can break something else. What am I missing?
Also, how can we go about writing a test case that demonstrates the issue?
The text was updated successfully, but these errors were encountered:
balajirrao
changed the title
'cannot reuse already awaited coroutine' error with timed_window on Python 3.7.5
'cannot reuse already awaited coroutine' with timed_window on Python 3.7.5
Nov 29, 2019
Using
timed_window
in Python 3.7.5 can sometimes lead to a coroutine being awaited more than once.Here's a sample program:
I narrowed down the reason to the same coroutine being possibly returned more than once in https://github.com/python-streamz/streamz/blob/master/streamz/core.py#L917.
A way to work around this issue is to create a task that runs the coroutine. Modifying the
update
method of theSink
class to return a task fixes the issue. The tests intests/core.py
continue pass.I'm quite sure this can break something else. What am I missing?
Also, how can we go about writing a test case that demonstrates the issue?
The text was updated successfully, but these errors were encountered: