This commit is contained in:
Lex Berezhny 2020-04-12 12:05:03 -04:00
parent 777c6342f8
commit 4e85f34353

View file

@ -66,7 +66,7 @@ class StreamController:
next_sub = next_sub._next next_sub = next_sub._next
yield subscription yield subscription
def _notify_and_create_task(self, notify): def _notify_and_ensure_future(self, notify):
tasks = [] tasks = []
for subscription in self._iterate_subscriptions: for subscription in self._iterate_subscriptions:
maybe_coroutine = notify(subscription) maybe_coroutine = notify(subscription)
@ -82,7 +82,7 @@ class StreamController:
def add(self, event): def add(self, event):
skip = self._merge_repeated and event == self._last_event skip = self._merge_repeated and event == self._last_event
self._last_event = event self._last_event = event
return self._notify_and_create_task( return self._notify_and_ensure_future(
lambda subscription: None if skip else subscription._add(event) lambda subscription: None if skip else subscription._add(event)
) )