mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-11-15 06:10:41 -05:00
Change the way we do logging contexts so that they survive divergences
This commit is contained in:
parent
db0dca2f6f
commit
476899295f
13 changed files with 128 additions and 97 deletions
|
|
@ -13,7 +13,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from synapse.util.logcontext import LoggingContext
|
||||
from synapse.util.logcontext import LoggingContext, PreserveLoggingContext
|
||||
|
||||
from twisted.internet import defer, reactor, task
|
||||
|
||||
|
|
@ -50,8 +50,10 @@ class Clock(object):
|
|||
current_context = LoggingContext.current_context()
|
||||
|
||||
def wrapped_callback():
|
||||
LoggingContext.thread_local.current_context = current_context
|
||||
callback()
|
||||
with PreserveLoggingContext():
|
||||
LoggingContext.thread_local.current_context = current_context
|
||||
callback()
|
||||
|
||||
return reactor.callLater(delay, wrapped_callback)
|
||||
|
||||
def cancel_call_later(self, timer):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue