cubicweb/server/repository.py
changeset 11988 ffde65347797
parent 11985 08398df041b4
child 11995 7d56ae4aa0ee
equal deleted inserted replaced
11987:d432911e3c26 11988:ffde65347797
   314                 self.vreg.init_properties(self.properties())
   314                 self.vreg.init_properties(self.properties())
   315         # 4. close initialization connection set and reopen fresh ones for
   315         # 4. close initialization connection set and reopen fresh ones for
   316         #    proper initialization
   316         #    proper initialization
   317         self.cnxsets.close()
   317         self.cnxsets.close()
   318         self.cnxsets = _CnxSetPool(self.system_source, pool_size)
   318         self.cnxsets = _CnxSetPool(self.system_source, pool_size)
       
   319         # 5. call instance level initialisation hooks
       
   320         self.hm.call_hooks('server_startup', repo=self)
   319 
   321 
   320     # internals ###############################################################
   322     # internals ###############################################################
   321 
   323 
   322     def init_sources_from_database(self):
   324     def init_sources_from_database(self):
   323         if self.config.quick_start or 'CWSource' not in self.schema:  # 3.10 migration
   325         if self.config.quick_start or 'CWSource' not in self.schema:  # 3.10 migration
   400         return appschema
   402         return appschema
   401 
   403 
   402     def _prepare_startup(self):
   404     def _prepare_startup(self):
   403         """Prepare "Repository as a server" for startup.
   405         """Prepare "Repository as a server" for startup.
   404 
   406 
   405         * trigger server startup hook,
       
   406         * register session clean up task.
   407         * register session clean up task.
   407         """
   408         """
   408         if not (self.config.creating or self.config.repairing
   409         if not (self.config.creating or self.config.repairing
   409                 or self.config.quick_start):
   410                 or self.config.quick_start):
   410             # call instance level initialisation hooks
       
   411             self.hm.call_hooks('server_startup', repo=self)
       
   412             # register a task to cleanup expired session
   411             # register a task to cleanup expired session
   413             if self._tasks_manager is not None:
   412             if self._tasks_manager is not None:
   414                 self.cleanup_session_time = self.config['cleanup-session-time'] or 60 * 60 * 24
   413                 self.cleanup_session_time = self.config['cleanup-session-time'] or 60 * 60 * 24
   415                 assert self.cleanup_session_time > 0
   414                 assert self.cleanup_session_time > 0
   416                 cleanup_session_interval = min(60 * 60, self.cleanup_session_time / 3)
   415                 cleanup_session_interval = min(60 * 60, self.cleanup_session_time / 3)