408 if not (self.config.creating or self.config.repairing |
408 if not (self.config.creating or self.config.repairing |
409 or self.config.quick_start): |
409 or self.config.quick_start): |
410 # call instance level initialisation hooks |
410 # call instance level initialisation hooks |
411 self.hm.call_hooks('server_startup', repo=self) |
411 self.hm.call_hooks('server_startup', repo=self) |
412 # register a task to cleanup expired session |
412 # register a task to cleanup expired session |
413 self.cleanup_session_time = self.config['cleanup-session-time'] or 60 * 60 * 24 |
413 if self._tasks_manager is not None: |
414 assert self.cleanup_session_time > 0 |
414 self.cleanup_session_time = self.config['cleanup-session-time'] or 60 * 60 * 24 |
415 cleanup_session_interval = min(60 * 60, self.cleanup_session_time / 3) |
415 assert self.cleanup_session_time > 0 |
416 assert self._tasks_manager is not None, \ |
416 cleanup_session_interval = min(60 * 60, self.cleanup_session_time / 3) |
417 "This Repository is not intended to be used as a server" |
417 self._tasks_manager.add_looping_task(cleanup_session_interval, |
418 self._tasks_manager.add_looping_task(cleanup_session_interval, |
418 self.clean_sessions) |
419 self.clean_sessions) |
|
420 |
419 |
421 def start_looping_tasks(self): |
420 def start_looping_tasks(self): |
422 """Actual "Repository as a server" startup. |
421 """Actual "Repository as a server" startup. |
423 |
422 |
424 * trigger server startup hook, |
423 * trigger server startup hook, |