]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add turn_delay parameter to QueueMixin constructor.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 3 Nov 2015 15:36:56 +0000 (15:36 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 3 Nov 2015 15:36:56 +0000 (15:36 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_cli_magic_folder.py

index 69070c7427ee9f454f65a433c7b56d3388f80eae..532d2de8c6f4eb78e57018bb2175403171d98879 100644 (file)
@@ -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()
index 866958e84f0b3b2c33cf02d5932558ff4a476f5d..e7f2c511c3a22afce945db8ec1b63ed0b78406bb 100644 (file)
@@ -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()