[server] Exit quickly when a looping task is registered in maintenance mode 3.25
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 29 Mar 2017 11:31:02 +0200
branch3.25
changeset 12110 a9266a72f3e0
parent 12109 425be06bb1e8
child 12111 cd069068a5ef
[server] Exit quickly when a looping task is registered in maintenance mode In such cases the repository will not have a scheduler on purpose because the repository will not be kept running and will quickly shutdown after migration so that it's undesirable to have looping tasks being executed.
cubicweb/server/repository.py
--- a/cubicweb/server/repository.py	Fri Mar 24 14:56:48 2017 +0100
+++ b/cubicweb/server/repository.py	Wed Mar 29 11:31:02 2017 +0200
@@ -405,6 +405,8 @@
         looping tasks can only be registered during repository initialization,
         once done this method will fail.
         """
+        if self.config.repairing:
+            return
         assert self._scheduler is not None, \
             "This Repository is not intended to be used as a server"
         event = utils.schedule_periodic_task(