summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-10-28 00:01:45 +0100
committerRory& <root@rory.gay>2025-11-13 14:08:47 +0100
commite1bf607f93561f8e33eeee86719a9dce7514322e (patch)
tree45a9f53af9f19945c33feca42d1e2f8f338e45aa
parentadmin api - send more data (diff)
downloadsynapse-emma/patches-old.tar.xz
Allow overriding max background task count emma/patches-old
Signed-off-by: Rory& <root@rory.gay>
-rw-r--r--get_sched_tasks.sql1
-rw-r--r--synapse/config/ratelimiting.py1
-rw-r--r--synapse/util/task_scheduler.py6
3 files changed, 8 insertions, 0 deletions
diff --git a/get_sched_tasks.sql b/get_sched_tasks.sql
new file mode 100644

index 0000000000..680342cfa2 --- /dev/null +++ b/get_sched_tasks.sql
@@ -0,0 +1 @@ +select * from scheduled_tasks where status != 'complete'; diff --git a/synapse/config/ratelimiting.py b/synapse/config/ratelimiting.py
index be2f49f87c..2209eb192d 100644 --- a/synapse/config/ratelimiting.py +++ b/synapse/config/ratelimiting.py
@@ -84,6 +84,7 @@ class RatelimitConfig(Config): section = "ratelimiting" def read_config(self, config: JsonDict, **kwargs: Any) -> None: + self.override_max_concurrent_running_tasks = config.get("ratelimiting", {}).get("override_max_concurrent_running_tasks", None) # Load the new-style messages config if it exists. Otherwise fall back # to the old method. if "rc_message" in config: diff --git a/synapse/util/task_scheduler.py b/synapse/util/task_scheduler.py
index 22b3bf8c15..7b50bc4109 100644 --- a/synapse/util/task_scheduler.py +++ b/synapse/util/task_scheduler.py
@@ -139,6 +139,12 @@ class TaskScheduler: hook=lambda: {(self.server_name,): len(self._running_tasks)}, ) + if hs.config.ratelimiting.override_max_concurrent_running_tasks is not None: + TaskScheduler.MAX_CONCURRENT_RUNNING_TASKS = ( + hs.config.ratelimiting.override_max_concurrent_running_tasks + ) + logger.warning("Max concurrent running tasks: %s, override: %s", TaskScheduler.MAX_CONCURRENT_RUNNING_TASKS, hs.config.ratelimiting.override_max_concurrent_running_tasks) + def register_action( self, function: Callable[