Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Revert "Do not return a value since nothing uses it."
Browse files Browse the repository at this point in the history
This reverts commit 6c27891.

Turns out the return value is used by Distributor.fire.
  • Loading branch information
clokep committed Sep 9, 2020
1 parent b400db3 commit 41ced4c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions synapse/util/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import inspect
import logging

from synapse.logging.context import run_in_background
from twisted.internet import defer

from synapse.logging.context import make_deferred_yieldable, run_in_background
from synapse.metrics.background_process_metrics import run_as_background_process

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -97,7 +99,9 @@ def fire(self, *args, **kwargs):
"""Invokes every callable in the observer list, passing in the args and
kwargs. Exceptions thrown by observers are logged but ignored. It is
not an error to fire a signal with no observers.
"""
Returns a Deferred that will complete when all the observers have
completed."""

async def do(observer):
try:
Expand All @@ -110,8 +114,11 @@ async def do(observer):
"%s signal observer %s failed: %r", self.name, observer, e,
)

for observer in self.observers:
run_in_background(do, observer)
deferreds = [run_in_background(do, o) for o in self.observers]

return make_deferred_yieldable(
defer.gatherResults(deferreds, consumeErrors=True)
)

def __repr__(self):
return "<Signal name=%r>" % (self.name,)

0 comments on commit 41ced4c

Please sign in to comment.