summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2017-01-05 13:01:31 +0000
committerGitHub <noreply@github.com>2017-01-05 13:01:31 +0000
commit7738329672e76824e98632d74380839f96e88f52 (patch)
treeb9a501be0dcd0c6bf7ab3e59b73363a05319910b
parentMerge pull request #1765 from matrix-org/markjh/timeout_get_missing_events (diff)
parentMore logging for the linearizer and for get_events (diff)
downloadsynapse-7738329672e76824e98632d74380839f96e88f52.tar.xz
Merge pull request #1766 from matrix-org/markjh/linear_logging
More logging for the linearizer and for get_events
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py2
-rw-r--r--synapse/util/async.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index ecb79c07ef..04dbdac3f8 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -1084,8 +1084,10 @@ class EventsStore(SQLBaseStore):
                     self._do_fetch
                 )
 
+        logger.info("Loading %d events", len(events))
         with PreserveLoggingContext():
             rows = yield events_d
+        logger.info("Loaded %d events (%d rows)", len(events), len(rows))
 
         if not allow_rejected:
             rows[:] = [r for r in rows if not r["rejects"]]
diff --git a/synapse/util/async.py b/synapse/util/async.py
index 4280455cbe..83875edc85 100644
--- a/synapse/util/async.py
+++ b/synapse/util/async.py
@@ -166,7 +166,11 @@ class Linearizer(object):
             # do some work.
 
     """
-    def __init__(self):
+    def __init__(self, name=None):
+        if name is None:
+            self.name = id(self)
+        else:
+            self.name = name
         self.key_to_defer = {}
 
     @defer.inlineCallbacks
@@ -185,15 +189,20 @@ class Linearizer(object):
         self.key_to_defer[key] = new_defer
 
         if current_defer:
-            logger.info("Waiting to acquire linearizer lock for key %r", key)
+            logger.info(
+                "Waiting to acquire linearizer lock %r for key %r", self.name, key
+            )
             with PreserveLoggingContext():
                 yield current_defer
 
+        logger.info("Acquired linearizer lock %r for key %r", self.name, key)
+
         @contextmanager
         def _ctx_manager():
             try:
                 yield
             finally:
+                logger.info("Releasing linearizer lock %r for key %r", self.name, key)
                 new_defer.callback(None)
                 current_d = self.key_to_defer.get(key)
                 if current_d is new_defer: