diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2023-08-21 14:17:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 14:17:13 +0200 |
commit | 358896e1b835bf693ef40d4cf9f10077432e935b (patch) | |
tree | c53830870b51f7d81e320cb5ce7a1f85df357116 /synapse/server.py | |
parent | Bump ijson from 3.2.1 to 3.2.3 (#16143) (diff) | |
download | synapse-358896e1b835bf693ef40d4cf9f10077432e935b.tar.xz |
Implements a task scheduler for resumable potentially long running tasks (#15891)
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/server.py b/synapse/server.py index e753ff0377..7cdd3ea3c2 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -142,6 +142,7 @@ from synapse.util.distributor import Distributor from synapse.util.macaroons import MacaroonGenerator from synapse.util.ratelimitutils import FederationRateLimiter from synapse.util.stringutils import random_string +from synapse.util.task_scheduler import TaskScheduler logger = logging.getLogger(__name__) @@ -360,6 +361,7 @@ class HomeServer(metaclass=abc.ABCMeta): """ for i in self.REQUIRED_ON_BACKGROUND_TASK_STARTUP: getattr(self, "get_" + i + "_handler")() + self.get_task_scheduler() def get_reactor(self) -> ISynapseReactor: """ @@ -912,6 +914,9 @@ class HomeServer(metaclass=abc.ABCMeta): """Usage metrics shared between phone home stats and the prometheus exporter.""" return CommonUsageMetricsManager(self) - @cache_in_self def get_worker_locks_handler(self) -> WorkerLocksHandler: return WorkerLocksHandler(self) + + @cache_in_self + def get_task_scheduler(self) -> TaskScheduler: + return TaskScheduler(self) |