From effebb3e88eaa30987a32d8d9a2331023fc5f12e Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sat, 18 May 2024 21:11:34 +0100 Subject: [PATCH] Oops! `Clock.time` gives seconds --- synapse/util/task_scheduler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/synapse/util/task_scheduler.py b/synapse/util/task_scheduler.py index 31922b1ce1..448960b297 100644 --- a/synapse/util/task_scheduler.py +++ b/synapse/util/task_scheduler.py @@ -395,25 +395,25 @@ class TaskScheduler: function = self._actions[task.action] def _occasional_report( - task_log_context: LoggingContext, start_time: int + task_log_context: LoggingContext, start_time: float ) -> None: """ Helper to log a 'Task continuing' line every so often. """ - current_time = int(self._clock.time()) + current_time = self._clock.time() calling_context = set_current_context(task_log_context) try: usage = task_log_context.get_resource_usage() TaskScheduler._log_task_usage( - "continuing", task, usage, (current_time - start_time) * 0.001 + "continuing", task, usage, current_time - start_time ) finally: set_current_context(calling_context) async def wrapper() -> None: with nested_logging_context(task.id) as log_context: - start_time = int(self._clock.time()) + start_time = self._clock.time() occasional_status_call = self._clock.looping_call( _occasional_report, TaskScheduler.OCCASIONAL_REPORT_INTERVAL_MS, @@ -441,10 +441,10 @@ class TaskScheduler: ) self._running_tasks.remove(task.id) - current_time = int(self._clock.time()) + current_time = self._clock.time() usage = log_context.get_resource_usage() TaskScheduler._log_task_usage( - status.value, task, usage, (current_time - start_time) * 0.001 + status.value, task, usage, current_time - start_time ) occasional_status_call.stop()