mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Merge pull request #466 from matrix-org/daniel/logloglog
Log when we skip daily messages
This commit is contained in:
commit
e5ea4fad78
@ -936,6 +936,7 @@ class EventsStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
now_reporting = self.cursor_to_dict(txn)
|
now_reporting = self.cursor_to_dict(txn)
|
||||||
if not now_reporting:
|
if not now_reporting:
|
||||||
|
logger.info("Calculating daily messages skipped; no now_reporting")
|
||||||
return None
|
return None
|
||||||
now_reporting = now_reporting[0]["stream_ordering"]
|
now_reporting = now_reporting[0]["stream_ordering"]
|
||||||
|
|
||||||
@ -948,11 +949,18 @@ class EventsStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not last_reported:
|
if not last_reported:
|
||||||
|
logger.info("Calculating daily messages skipped; no last_reported")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Close enough to correct for our purposes.
|
# Close enough to correct for our purposes.
|
||||||
yesterday = (now - 24 * 60 * 60)
|
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
|
return None
|
||||||
|
|
||||||
txn.execute(
|
txn.execute(
|
||||||
@ -968,6 +976,7 @@ class EventsStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
rows = self.cursor_to_dict(txn)
|
rows = self.cursor_to_dict(txn)
|
||||||
if not rows:
|
if not rows:
|
||||||
|
logger.info("Calculating daily messages skipped; messages count missing")
|
||||||
return None
|
return None
|
||||||
return rows[0]["messages"]
|
return rows[0]["messages"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user