Give some more things logcontexts (#4077)
This commit is contained in:
parent
5c445114d3
commit
b3f6dddad2
|
@ -0,0 +1 @@
|
||||||
|
Give some more things logcontexts
|
|
@ -17,8 +17,8 @@ import logging
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.errors import SynapseError
|
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.types import UserID, create_requester
|
||||||
from synapse.util.logcontext import run_in_background
|
|
||||||
|
|
||||||
from ._base import BaseHandler
|
from ._base import BaseHandler
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class DeactivateAccountHandler(BaseHandler):
|
||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
if not self._user_parter_running:
|
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
|
@defer.inlineCallbacks
|
||||||
def _user_parter_loop(self):
|
def _user_parter_loop(self):
|
||||||
|
|
|
@ -20,6 +20,7 @@ from six import iteritems
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.constants import EventTypes, JoinRules, Membership
|
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.storage.roommember import ProfileInfo
|
||||||
from synapse.types import get_localpart_from_id
|
from synapse.types import get_localpart_from_id
|
||||||
from synapse.util.metrics import Measure
|
from synapse.util.metrics import Measure
|
||||||
|
@ -98,7 +99,6 @@ class UserDirectoryHandler(object):
|
||||||
"""
|
"""
|
||||||
return self.store.search_user_dir(user_id, search_term, limit)
|
return self.store.search_user_dir(user_id, search_term, limit)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def notify_new_event(self):
|
def notify_new_event(self):
|
||||||
"""Called when there may be more deltas to process
|
"""Called when there may be more deltas to process
|
||||||
"""
|
"""
|
||||||
|
@ -108,11 +108,15 @@ class UserDirectoryHandler(object):
|
||||||
if self._is_processing:
|
if self._is_processing:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def process():
|
||||||
|
try:
|
||||||
|
yield self._unsafe_process()
|
||||||
|
finally:
|
||||||
|
self._is_processing = False
|
||||||
|
|
||||||
self._is_processing = True
|
self._is_processing = True
|
||||||
try:
|
run_as_background_process("user_directory.notify_new_event", process)
|
||||||
yield self._unsafe_process()
|
|
||||||
finally:
|
|
||||||
self._is_processing = False
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def handle_local_profile_change(self, user_id, profile):
|
def handle_local_profile_change(self, user_id, profile):
|
||||||
|
|
Loading…
Reference in New Issue