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

Commit

Permalink
Give some more things logcontexts (#4077)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh authored Oct 23, 2018
1 parent 5c44511 commit b3f6ddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/4077.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Give some more things logcontexts
4 changes: 2 additions & 2 deletions synapse/handlers/deactivate_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from twisted.internet import defer

from synapse.api.errors import SynapseError
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.types import UserID, create_requester
from synapse.util.logcontext import run_in_background

from ._base import BaseHandler

Expand Down Expand Up @@ -121,7 +121,7 @@ def _start_user_parting(self):
None
"""
if not self._user_parter_running:
run_in_background(self._user_parter_loop)
run_as_background_process("user_parter_loop", self._user_parter_loop)

@defer.inlineCallbacks
def _user_parter_loop(self):
Expand Down
14 changes: 9 additions & 5 deletions synapse/handlers/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from twisted.internet import defer

from synapse.api.constants import EventTypes, JoinRules, Membership
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.storage.roommember import ProfileInfo
from synapse.types import get_localpart_from_id
from synapse.util.metrics import Measure
Expand Down Expand Up @@ -98,7 +99,6 @@ def search_users(self, user_id, search_term, limit):
"""
return self.store.search_user_dir(user_id, search_term, limit)

@defer.inlineCallbacks
def notify_new_event(self):
"""Called when there may be more deltas to process
"""
Expand All @@ -108,11 +108,15 @@ def notify_new_event(self):
if self._is_processing:
return

@defer.inlineCallbacks
def process():
try:
yield self._unsafe_process()
finally:
self._is_processing = False

self._is_processing = True
try:
yield self._unsafe_process()
finally:
self._is_processing = False
run_as_background_process("user_directory.notify_new_event", process)

@defer.inlineCallbacks
def handle_local_profile_change(self, user_id, profile):
Expand Down

0 comments on commit b3f6ddd

Please sign in to comment.