Skip to content

Commit

Permalink
tools: respond to jelle's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
manannayak authored and JelleZijlstra committed Oct 10, 2016
1 parent 4a52efc commit 804d2c2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions asynq/tools.py
Expand Up @@ -312,10 +312,9 @@ def pause(self):
class AsyncEventHook(EventHook):
"""EventHook that supports async handlers.
When the event triggers, all the handlers will be invoked asynchronously using async_call.
When the event triggers, all the async handlers will be invoked asynchronously.
Since it uses async_call, it supports normal handlers by default
(they don't need to be @async() decorated).
All non-async handlers will be invoked normally (same as EventHook).
"""

Expand All @@ -327,9 +326,8 @@ def trigger(self, *args):
def safe_trigger(self, *args):
wrapped_handlers = [self._create_safe_wrapper(handler) for handler in self]
results = yield [wrapped_handler.async(*args) for wrapped_handler in wrapped_handlers]
results = filter(None, results)
if len(results) > 0:
reraise(results[0])
for error in filter(None, results):
reraise(error)

@staticmethod
def _create_safe_wrapper(handler):
Expand Down

0 comments on commit 804d2c2

Please sign in to comment.