mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 04:13:51 +01:00
Indirect evt_count updates via method call
so that we can stub it for the sentinel and not have a billion failing UTs
This commit is contained in:
parent
b088aafcae
commit
0495fe0035
2 changed files with 12 additions and 1 deletions
|
@ -147,7 +147,7 @@ class EventsWorkerStore(SQLBaseStore):
|
||||||
|
|
||||||
if missing_events_ids:
|
if missing_events_ids:
|
||||||
log_ctx = LoggingContext.current_context()
|
log_ctx = LoggingContext.current_context()
|
||||||
log_ctx.evt_db_fetch_count += len(missing_events_ids)
|
log_ctx.record_event_fetch(len(missing_events_ids))
|
||||||
|
|
||||||
missing_events = yield self._enqueue_events(
|
missing_events = yield self._enqueue_events(
|
||||||
missing_events_ids,
|
missing_events_ids,
|
||||||
|
|
|
@ -91,6 +91,9 @@ class LoggingContext(object):
|
||||||
def add_database_scheduled(self, sched_sec):
|
def add_database_scheduled(self, sched_sec):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def record_event_fetch(self, event_count):
|
||||||
|
pass
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
return False
|
return False
|
||||||
__bool__ = __nonzero__ # python3
|
__bool__ = __nonzero__ # python3
|
||||||
|
@ -247,6 +250,14 @@ class LoggingContext(object):
|
||||||
"""
|
"""
|
||||||
self.db_sched_duration_sec += sched_sec
|
self.db_sched_duration_sec += sched_sec
|
||||||
|
|
||||||
|
def record_event_fetch(self, event_count):
|
||||||
|
"""Record a number of events being fetched from the db
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event_count (int): number of events being fetched
|
||||||
|
"""
|
||||||
|
self.evt_db_fetch_count += event_count
|
||||||
|
|
||||||
|
|
||||||
class LoggingContextFilter(logging.Filter):
|
class LoggingContextFilter(logging.Filter):
|
||||||
"""Logging filter that adds values from the current logging context to each
|
"""Logging filter that adds values from the current logging context to each
|
||||||
|
|
Loading…
Reference in a new issue