summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/16656.misc1
-rw-r--r--synapse/handlers/device.py2
-rw-r--r--synapse/util/task_scheduler.py2
3 files changed, 3 insertions, 2 deletions
diff --git a/changelog.d/16656.misc b/changelog.d/16656.misc
new file mode 100644
index 0000000000..6763685b9d
--- /dev/null
+++ b/changelog.d/16656.misc
@@ -0,0 +1 @@
+Reduce max concurrency of background tasks, reducing potential max DB load.
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py
index 1af6d77545..98e6e42563 100644
--- a/synapse/handlers/device.py
+++ b/synapse/handlers/device.py
@@ -383,7 +383,7 @@ class DeviceWorkerHandler:
         )
 
     DEVICE_MSGS_DELETE_BATCH_LIMIT = 1000
-    DEVICE_MSGS_DELETE_SLEEP_MS = 1000
+    DEVICE_MSGS_DELETE_SLEEP_MS = 100
 
     async def _delete_device_messages(
         self,
diff --git a/synapse/util/task_scheduler.py b/synapse/util/task_scheduler.py
index 29c561e555..8c2df233d3 100644
--- a/synapse/util/task_scheduler.py
+++ b/synapse/util/task_scheduler.py
@@ -71,7 +71,7 @@ class TaskScheduler:
     # Time before a complete or failed task is deleted from the DB
     KEEP_TASKS_FOR_MS = 7 * 24 * 60 * 60 * 1000  # 1 week
     # Maximum number of tasks that can run at the same time
-    MAX_CONCURRENT_RUNNING_TASKS = 10
+    MAX_CONCURRENT_RUNNING_TASKS = 5
     # Time from the last task update after which we will log a warning
     LAST_UPDATE_BEFORE_WARNING_MS = 24 * 60 * 60 * 1000  # 24hrs