diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-04-27 11:29:27 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-04-27 12:55:51 +0100 |
commit | 2a13af23bc0561ab48e0a90528231c40ee209724 (patch) | |
tree | 55b806d5723d009cee8c9e925530dc5cedb1c37a /synapse/handlers/typing.py | |
parent | Merge pull request #3134 from matrix-org/erikj/fix_admin_media_api (diff) | |
download | synapse-2a13af23bc0561ab48e0a90528231c40ee209724.tar.xz |
Use run_in_background in preference to preserve_fn
While I was going through uses of preserve_fn for other PRs, I converted places which only use the wrapped function once to use run_in_background, to avoid creating the function object.
Diffstat (limited to 'synapse/handlers/typing.py')
-rw-r--r-- | synapse/handlers/typing.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py index 77c0cf146f..19cde70adf 100644 --- a/synapse/handlers/typing.py +++ b/synapse/handlers/typing.py @@ -16,7 +16,7 @@ from twisted.internet import defer from synapse.api.errors import SynapseError, AuthError -from synapse.util.logcontext import preserve_fn +from synapse.util.logcontext import run_in_background from synapse.util.metrics import Measure from synapse.util.wheel_timer import WheelTimer from synapse.types import UserID, get_domain_from_id @@ -97,7 +97,8 @@ class TypingHandler(object): if self.hs.is_mine_id(member.user_id): last_fed_poke = self._member_last_federation_poke.get(member, None) if not last_fed_poke or last_fed_poke + FEDERATION_PING_INTERVAL <= now: - preserve_fn(self._push_remote)( + run_in_background( + self._push_remote, member=member, typing=True ) @@ -196,7 +197,7 @@ class TypingHandler(object): def _push_update(self, member, typing): if self.hs.is_mine_id(member.user_id): # Only send updates for changes to our own users. - preserve_fn(self._push_remote)(member, typing) + run_in_background(self._push_remote, member, typing) self._push_update_local( member=member, |