Skip to content

Commit

Permalink
fixing dispose for ToFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
semiversus committed Jun 15, 2018
1 parent 309a73a commit 2af3278
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions broqer/op/to_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ def _timeout(self):
self.set_exception(asyncio.TimeoutError)

def _future_done(self, future):
if self._disposable is not None:
self._disposable.dispose()
self._disposable = None
if self._timeout_handle is not None:
self._timeout_handle.cancel()

def emit(self, *args: Any, who: Publisher) -> None:
if self._disposable is not None:
self._disposable.dispose()
self._disposable = None
if len(args) == 1:
self.set_result(args[0])
else:
Expand Down

0 comments on commit 2af3278

Please sign in to comment.