Skip to content

Commit

Permalink
Wait only if the promise is not pending
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Mar 5, 2017
1 parent 1f103fd commit f98004e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions promise/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ def _event(self):
return self._event_instance

def _wait(self, timeout=None):
if not self.is_pending:
# We return if the promise is already
# fulfilled or rejected
return

target = self._target()
if target._trace:
# If we wait, we drain the queue of the
Expand Down

0 comments on commit f98004e

Please sign in to comment.