コード例 #1
0
 def collect_deltas(source, dest):
     for delta in source[0].get_changes():
         if delta:
             LOGGER.debug(
                 f"Incremental delta received from {source[0]}:\n{delta}"
             )
             self._queue.put((delta, source, dest))
     LOGGER.trace("Collector thread is terminating.")
コード例 #2
0
ファイル: drive.py プロジェクト: P403n1x87/erwin
    def get_changes(self):
        backoff = 5
        while True:
            LOGGER.trace(f"Getting Drive changes (backoff: {backoff})")
            try:
                with STATE_LOCK:
                    yield self._get_changes()

                backoff = 5
                CONNECTED.set()

            except ServerNotFoundError:
                backoff *= 1.618
                LOGGER.error(
                    f"The Google Drive API is unreachable. Retrying in {int(backoff)} seconds."
                )

            finally:
                sleep(backoff)