[etwist] Do not call repository's start_looping_tasks anymore and warn about this
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 06 Mar 2017 14:19:20 +0100
changeset 12008 7694dcf5ad30
parent 12007 b82cda5ba3bf
child 12009 a939b3a18d8e
[etwist] Do not call repository's start_looping_tasks anymore and warn about this We are about to drop this method from Repository class and replace it by a blocking alternative. This is not compatible with how things currently work in a Twisted server implementation. So do not start repository "looping tasks" in Twisted server anymore and issue a warning about this. If someone is interested in restoring the "all-in-one" behavior where the repository runs within a Twisted server, they may start by implementing repository looping tasks using a Twisted mechanism such as, e.g., http://twistedmatrix.com/documents/current/core/howto/time.html and eventually provide the repository with a compatible scheduler instance so that is can register its periodic tasks. At the moment, we lack resources to do this (and maintain the Twisted server of CubicWeb in general). Related to #17057223.
cubicweb/etwist/server.py
--- a/cubicweb/etwist/server.py	Thu Mar 09 09:16:00 2017 +0100
+++ b/cubicweb/etwist/server.py	Mon Mar 06 14:19:20 2017 +0100
@@ -22,6 +22,7 @@
 import threading
 from cgi import FieldStorage, parse_header
 from functools import partial
+import warnings
 
 from cubicweb.statsd_logger import statsd_timeit
 
@@ -68,7 +69,10 @@
             if config.mode != 'test':
                 reactor.addSystemEventTrigger('before', 'shutdown',
                                               self.shutdown_event)
-                self.appli.repo.start_looping_tasks()
+                warnings.warn(
+                    'twisted server does not start repository looping tasks anymore; '
+                    'use the standalone "scheduler" command if needed'
+                )
         self.set_url_rewriter()
         CW_EVENT_MANAGER.bind('after-registry-reload', self.set_url_rewriter)