diff --git a/agkyra/syncer/localfs_client.py b/agkyra/syncer/localfs_client.py index 92fe51089f823136fb662f6692ae335e63e98b31..d7349acffa9b1fa084324948f666e44242bbf92d 100644 --- a/agkyra/syncer/localfs_client.py +++ b/agkyra/syncer/localfs_client.py @@ -632,26 +632,23 @@ class LocalfsFileClient(FileClient): path = utils.to_unicode(path) except UnicodeDecodeError as e: return + if path.startswith(self.CACHEPATH): + return rel_path = os.path.relpath(path, start=self.ROOTPATH) objname = utils.to_standard_sep(rel_path) with self.probe_candidates.lock() as d: d[objname] = self.none_info() - cachepath = utils.from_unicode(self.CACHEPATH) class EventHandler(FileSystemEventHandler): def on_created(this, event): # if not event.is_directory: # return path = event.src_path - if path.startswith(cachepath): - return logger.debug("Handling %s" % event) handle_path(path) def on_deleted(this, event): path = event.src_path - if path.startswith(cachepath): - return logger.debug("Handling %s" % event) handle_path(path) @@ -659,17 +656,12 @@ class LocalfsFileClient(FileClient): if event.is_directory: return path = event.src_path - if path.startswith(cachepath): - return logger.debug("Handling %s" % event) handle_path(path) def on_moved(this, event): src_path = event.src_path dest_path = event.dest_path - if src_path.startswith(cachepath) or \ - dest_path.startswith(cachepath): - return logger.debug("Handling %s" % event) handle_path(src_path) handle_path(dest_path) diff --git a/test.py b/test.py index a14aae340dd171ba9447e2996913ce2e0ccc6ab2..2d8be6d4755a0f13d25afde572b069ed10064027 100644 --- a/test.py +++ b/test.py @@ -192,16 +192,20 @@ class AgkyraTest(unittest.TestCase): f_cache = "Ο0002cache" f_upd = "Ο0002upd" f_ren = "Ο0002ren" + f_cached = "Ο0002cached" dbefore = "Ξ΄0002before" f_out_path = self.get_path(f_out) f_cache_path = self.get_path(f_cache) f_upd_path = self.get_path(f_upd) f_ren_path = self.get_path(f_ren) + f_cached_path = os.path.join( + self.settings.cache_path, f_cached) dbefore_path = self.get_path(dbefore) open(f_out_path, "a").close() open(f_cache_path, "a").close() open(f_upd_path, "a").close() open(f_ren_path, "a").close() + open(f_cached_path, "a").close() os.mkdir(dbefore_path) notifier = self.slave.notifier() @@ -236,12 +240,16 @@ class AgkyraTest(unittest.TestCase): f_ren_new_path = self.get_path(f_ren_new) os.rename(f_ren_path, f_ren_new_path) + f_cached_out_path = self.get_path(f_cached) + os.rename(f_cached_path, f_cached_out_path) + time.sleep(1) candidates = self.slave.list_candidate_files() self.assertEqual(sorted(candidates), sorted([fafter, dafter, f_in, f_out, f_upd, - f_ren, f_ren_new])) + f_ren, f_ren_new, + f_cache, f_cached])) notifier.stop() def test_001_probe_and_sync(self): @@ -320,11 +328,17 @@ class AgkyraTest(unittest.TestCase): # now probe upstream too and retry self.s.probe_file(self.s.MASTER, fil) self.assert_message(messaging.UpdateMessage) + self.s.start_notifiers() self.s.decide_file_sync(fil) self.assert_message(messaging.FailedSyncIgnoreDecisionMessage) self.assert_message(messaging.SyncMessage) - self.assert_message(messaging.ConflictStashMessage) + m = self.assert_message(messaging.ConflictStashMessage) + stash_name = m.stash_name self.assert_message(messaging.AckSyncMessage) + time.sleep(1) + self.s.stop_notifiers() + local_cands = self.slave.list_candidate_files() + self.assertIn(stash_name, local_cands) def test_003_dirs(self): # make local dir with files