summary refs log tree commit diff
path: root/synapse/util/__init__.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-11-19 16:37:43 +0000
committerMark Haines <mark.haines@matrix.org>2014-11-19 16:37:43 +0000
commit97c7c34f6f71238dcb364374733c1f2200d6b982 (patch)
tree944a2d841a5eae9fac1baff9fc5e0c504a3f7cb0 /synapse/util/__init__.py
parentSYN-141: Encode query params as UTF-8. (diff)
downloadsynapse-97c7c34f6f71238dcb364374733c1f2200d6b982.tar.xz
Preserve logging context in a few more places, drop the logging context after it has been stashed to reduce potential for confusion
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r--synapse/util/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index c9a73b0413..9ad613b8f1 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from synapse.util.logcontext import LoggingContext
 
 from twisted.internet import reactor
 
@@ -35,7 +36,11 @@ class Clock(object):
         return self.time() * 1000
 
     def call_later(self, delay, callback):
-        return reactor.callLater(delay, callback)
+        current_context = LoggingContext.current_context()
+        def wrapped_callback():
+            current_context.thread_local.current_context = current_context
+            callback()
+        return reactor.callLater(delay, wrapped_callback)
 
     def cancel_call_later(self, timer):
         timer.cancel()