Skip to content
Snippets Groups Projects
Unverified Commit d56f4803 authored by Sean Quah's avatar Sean Quah Committed by GitHub
Browse files

Fix logging context warnings due to common usage metrics setup (#14574)


`setup()` is run under the sentinel context manager, so we wrap the
initial update in a background process. Before this change, Synapse
would log two warnings on startup:
    Starting db txn 'count_daily_users' from sentinel context
    Starting db connection from sentinel context: metrics will be lost

Signed-off-by: default avatarSean Quah <seanq@matrix.org>
parent d748bbc8
No related branches found
No related tags found
No related merge requests found
Fix a bug introduced in Synapse 1.67.0 where two logging context warnings would be logged on startup.
...@@ -54,7 +54,9 @@ class CommonUsageMetricsManager: ...@@ -54,7 +54,9 @@ class CommonUsageMetricsManager:
async def setup(self) -> None: async def setup(self) -> None:
"""Keep the gauges for common usage metrics up to date.""" """Keep the gauges for common usage metrics up to date."""
await self._update_gauges() run_as_background_process(
desc="common_usage_metrics_update_gauges", func=self._update_gauges
)
self._clock.looping_call( self._clock.looping_call(
run_as_background_process, run_as_background_process,
5 * 60 * 1000, 5 * 60 * 1000,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment