summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-01-06 17:28:55 +0000
committerDavid Baker <dave@matrix.org>2016-01-06 17:28:55 +0000
commit442fcc02f70fd0ae0034fc15c79b9e521c3d0143 (patch)
tree9d20a280a761ac50f227ebb8e4b8c74d354bb8df /synapse/storage/events.py
parentAdding is_guest here won't work because it just constructs a dict of uid -> p... (diff)
parentMerge pull request #469 from matrix-org/markjh/joined_guest_access (diff)
downloadsynapse-442fcc02f70fd0ae0034fc15c79b9e521c3d0143.tar.xz
Merge remote-tracking branch 'origin/develop' into store_event_actions
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index fc5725097c..ab500d728a 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -936,6 +936,7 @@ class EventsStore(SQLBaseStore):
             )
             now_reporting = self.cursor_to_dict(txn)
             if not now_reporting:
+                logger.info("Calculating daily messages skipped; no now_reporting")
                 return None
             now_reporting = now_reporting[0]["stream_ordering"]
 
@@ -948,11 +949,18 @@ class EventsStore(SQLBaseStore):
             )
 
             if not last_reported:
+                logger.info("Calculating daily messages skipped; no last_reported")
                 return None
 
             # Close enough to correct for our purposes.
             yesterday = (now - 24 * 60 * 60)
-            if math.fabs(yesterday - last_reported[0]["reported_time"]) > 60 * 60:
+            since_yesterday_seconds = yesterday - last_reported[0]["reported_time"]
+            any_since_yesterday = math.fabs(since_yesterday_seconds) > 60 * 60
+            if any_since_yesterday:
+                logger.info(
+                    "Calculating daily messages skipped; since_yesterday_seconds: %d" %
+                    (since_yesterday_seconds,)
+                )
                 return None
 
             txn.execute(
@@ -968,6 +976,7 @@ class EventsStore(SQLBaseStore):
             )
             rows = self.cursor_to_dict(txn)
             if not rows:
+                logger.info("Calculating daily messages skipped; messages count missing")
                 return None
             return rows[0]["messages"]