From a91097de0cb6affdfd88555889389c731a3cbfa4 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 3 Nov 2015 15:36:56 +0000 Subject: [PATCH] Add turn_delay parameter to QueueMixin constructor. Signed-off-by: Daira Hopwood --- src/allmydata/frontends/magic_folder.py | 11 +++++------ src/allmydata/test/test_cli_magic_folder.py | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 69070c74..532d2de8 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -96,12 +96,13 @@ class MagicFolder(service.MultiService): class QueueMixin(HookMixin): - def __init__(self, client, local_path_u, db, name, clock): + def __init__(self, client, local_path_u, db, name, turn_delay, clock): self._client = client self._local_path_u = local_path_u self._local_filepath = to_filepath(local_path_u) self._db = db self._name = name + self._turn_delay = turn_delay self._clock = clock self._hooks = {'processed': None, 'started': None} self.started_d = self.set_hook('started') @@ -118,7 +119,6 @@ class QueueMixin(HookMixin): self._deque = deque() self._lazy_tail = defer.succeed(None) self._stopped = False - self._turn_delay = 0 def _get_filepath(self, relpath_u): self._log("_get_filepath(%r)" % (relpath_u,)) @@ -167,7 +167,7 @@ class QueueMixin(HookMixin): class Uploader(QueueMixin): def __init__(self, client, local_path_u, db, upload_dirnode, pending_delay, clock, immediate=False): - QueueMixin.__init__(self, client, local_path_u, db, 'uploader', clock) + QueueMixin.__init__(self, client, local_path_u, db, 'uploader', 0, clock) self.is_ready = False self._immediate = immediate @@ -502,7 +502,8 @@ class Downloader(QueueMixin, WriteFileMixin): REMOTE_SCAN_INTERVAL = 3 # facilitates tests def __init__(self, client, local_path_u, db, collective_dirnode, upload_readonly_dircap, clock): - QueueMixin.__init__(self, client, local_path_u, db, 'downloader', clock) + QueueMixin.__init__(self, client, local_path_u, db, 'downloader', + self.REMOTE_SCAN_INTERVAL, clock) if not IDirectoryNode.providedBy(collective_dirnode): raise AssertionError("The URI in '%s' does not refer to a directory." @@ -514,8 +515,6 @@ class Downloader(QueueMixin, WriteFileMixin): self._collective_dirnode = collective_dirnode self._upload_readonly_dircap = upload_readonly_dircap - self._turn_delay = self.REMOTE_SCAN_INTERVAL - def start_scanning(self): self._log("start_scanning") files = self._db.get_all_relpaths() diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index 866958e8..e7f2c511 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -113,7 +113,6 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.get_clientdir(i=client_num)) magicfolder = MagicFolder(self.get_client(client_num), upload_dircap, collective_dircap, local_magic_dir, dbfile, pending_delay=0.2, clock=clock) - magicfolder.downloader._turn_delay = 0 magicfolder.setServiceParent(self.get_client(client_num)) magicfolder.ready() -- 2.45.2