From 6088303efb0f1498401718797941542089c2d432 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 17 Nov 2023 16:36:02 +0000 Subject: [PATCH] Speed up how quickly we launch new tasks (#16660) Now that we're reducing concurrency (#16656), this is more important. --- changelog.d/16660.misc | 1 + synapse/util/task_scheduler.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/16660.misc diff --git a/changelog.d/16660.misc b/changelog.d/16660.misc new file mode 100644 index 0000000000..6763685b9d --- /dev/null +++ b/changelog.d/16660.misc @@ -0,0 +1 @@ +Reduce max concurrency of background tasks, reducing potential max DB load. diff --git a/synapse/util/task_scheduler.py b/synapse/util/task_scheduler.py index 8c2df233d3..b254d3f84c 100644 --- a/synapse/util/task_scheduler.py +++ b/synapse/util/task_scheduler.py @@ -377,7 +377,7 @@ class TaskScheduler: self._running_tasks.remove(task.id) # Try launch a new task since we've finished with this one. - self._clock.call_later(1, self._launch_scheduled_tasks) + self._clock.call_later(0.1, self._launch_scheduled_tasks) if len(self._running_tasks) >= TaskScheduler.MAX_CONCURRENT_RUNNING_TASKS: return