Пример #1
0
 def run(self, interval):
     self.log.info('Starting updater service')
     last_update = 0
     while True:
         now = time.time()
         sleep = interval + last_update - now
         if sleep > 0:
             self.log.info('Sleeping for %s', human_readable_duration(sleep))
             time.sleep(sleep)
         try:
             with TrapErrors():
                 scanner.run(logger=self.log)
                 feeds.run(logger=self.log, force=False)
         except TrapError, exc:
             self.log.error('Processing Error', exc_info=exc.args)
         last_update = now
Пример #2
0
 def handle_noargs(self,
                   max_links=None,
                   dry_run=False,
                   log_stream=None,
                   fork=False,
                   num_workers=None,
                   use_multiprocessing=True,
                   **kwargs):
     try:
         scanner.run(max_links=max_links,
                     dry_run=dry_run,
                     log_stream=log_stream,
                     fork=fork,
                     num_workers=num_workers,
                     use_multiprocessing=use_multiprocessing)
     except LockError, exc:
         raise CommandError(exc)