_begin_processing cleanups

This commit is contained in:
Jean-Paul Calderone 2019-02-20 13:23:50 -05:00
parent 7d2827b93d
commit 42c1d3939f

View File

@ -656,7 +656,10 @@ class QueueMixin(HookMixin):
self._processing_loop = None self._processing_loop = None
return d return d
def _begin_processing(self, res): def _begin_processing(self):
"""
Start a loop that looks for work to do and then does it.
"""
self._processing_loop = task.LoopingCall(self._processing_iteration) self._processing_loop = task.LoopingCall(self._processing_iteration)
self._processing_loop.clock = self._clock self._processing_loop.clock = self._clock
self._processing = self._processing_loop.start(self._scan_delay(), now=True) self._processing = self._processing_loop.start(self._scan_delay(), now=True)
@ -669,8 +672,6 @@ class QueueMixin(HookMixin):
self._log(f) self._log(f)
self._processing.addErrback(fatal_error) self._processing.addErrback(fatal_error)
return res
def _processing_iteration(self): def _processing_iteration(self):
""" """
One iteration runs self._process_deque which calls _perform_scan() and One iteration runs self._process_deque which calls _perform_scan() and
@ -915,9 +916,7 @@ class Uploader(QueueMixin):
self._add_pending(relpath_u) self._add_pending(relpath_u)
self._full_scan() self._full_scan()
# XXX changed this while re-basing; double check we can return self._begin_processing()
# *really* just call this synchronously.
return self._begin_processing(None)
def _scan_delay(self): def _scan_delay(self):
return self._pending_delay return self._pending_delay
@ -1362,8 +1361,8 @@ class Downloader(QueueMixin, WriteFileMixin):
try: try:
data = yield self._scan_remote_collective(scan_self=True) data = yield self._scan_remote_collective(scan_self=True)
twlog.msg("Completed initial Magic Folder scan successfully ({})".format(self)) twlog.msg("Completed initial Magic Folder scan successfully ({})".format(self))
x = yield self._begin_processing(data) self._begin_processing()
defer.returnValue(x) defer.returnValue(data)
break break
except Exception as e: except Exception as e: