[server] Call 'server_startup' hooks at the end of repository "bootstrap"
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 28 Feb 2017 16:55:32 +0100
changeset 11988 ffde65347797
parent 11987 d432911e3c26
child 11989 309cf6a2c24f
[server] Call 'server_startup' hooks at the end of repository "bootstrap" Now that we have guarded all calls to Repository.looping_task() in 'server_startup' hooks we can execute this hooks category at bootstrap step. This way, repositories running without a tasks manager (i.e. those embedded into a WSGI application) will have these hooks triggered.
cubicweb/server/repository.py
--- a/cubicweb/server/repository.py	Tue Feb 28 16:46:16 2017 +0100
+++ b/cubicweb/server/repository.py	Tue Feb 28 16:55:32 2017 +0100
@@ -316,6 +316,8 @@
         #    proper initialization
         self.cnxsets.close()
         self.cnxsets = _CnxSetPool(self.system_source, pool_size)
+        # 5. call instance level initialisation hooks
+        self.hm.call_hooks('server_startup', repo=self)
 
     # internals ###############################################################
 
@@ -402,13 +404,10 @@
     def _prepare_startup(self):
         """Prepare "Repository as a server" for startup.
 
-        * trigger server startup hook,
         * register session clean up task.
         """
         if not (self.config.creating or self.config.repairing
                 or self.config.quick_start):
-            # call instance level initialisation hooks
-            self.hm.call_hooks('server_startup', repo=self)
             # register a task to cleanup expired session
             if self._tasks_manager is not None:
                 self.cleanup_session_time = self.config['cleanup-session-time'] or 60 * 60 * 24