# HG changeset patch # User Denis Laxalde # Date 1490780251 -7200 # Node ID cd069068a5ef026dbfee9017e4d595af8aaa4430 # Parent a9266a72f3e0ab75379e24965bc82d86b0fb1815 [server] Warn instead of failing when a looping task is registered and repo has no scheduler We should provide a way for client code to detect if they should register the looping task or not. See next patch for that. diff -r a9266a72f3e0 -r cd069068a5ef cubicweb/server/repository.py --- a/cubicweb/server/repository.py Wed Mar 29 11:31:02 2017 +0200 +++ b/cubicweb/server/repository.py Wed Mar 29 11:37:31 2017 +0200 @@ -407,8 +407,12 @@ """ if self.config.repairing: return - assert self._scheduler is not None, \ - "This Repository is not intended to be used as a server" + if self._scheduler is None: + self.warning( + 'looping task %s will not run in this process where repository ' + 'has no scheduler; use "cubicweb-ctl scheduler " to ' + 'have it running', func) + return event = utils.schedule_periodic_task( self._scheduler, interval, func, *args) self.info('scheduled periodic task %s (interval: %.2fs)',