diff --git a/swh/fuse/fuse.py b/swh/fuse/fuse.py --- a/swh/fuse/fuse.py +++ b/swh/fuse/fuse.py @@ -60,9 +60,6 @@ self._next_inode += 1 self._inode2entry[inode] = entry - # TODO add inode recycling with invocation to invalidate_inode when - # the dicts get too big - return inode def _remove_inode(self, inode: int) -> None: @@ -71,6 +68,11 @@ except KeyError: pass + try: + pyfuse3.invalidate_inode(inode) + except FileNotFoundError: + pass + def inode2entry(self, inode: int) -> FuseEntry: """ Return the entry matching a given inode """ diff --git a/swh/fuse/tests/test_revision.py b/swh/fuse/tests/test_revision.py --- a/swh/fuse/tests/test_revision.py +++ b/swh/fuse/tests/test_revision.py @@ -72,9 +72,14 @@ assert depth2 in (os.listdir(dir_by_page / depth1)) dir_by_date = dir_path / "by-date" - # TODO: rely on .status file instead to wait - # Wait 2 seconds to populate by-date/ dir - time.sleep(2) + # Wait max 2 seconds to populate by-date/ dir + for i in range(200): + entries = os.listdir(dir_by_date) + if entries and ".status" not in entries: + break + time.sleep(0.1) + assert not (dir_by_date / ".status").exists() + for swhid in expected: meta = get_data_from_web_archive(str(swhid)) date = dateutil.parser.parse(meta["date"]) @@ -84,4 +89,3 @@ depth2 = str(swhid) assert (dir_by_date / depth1).exists() assert depth2 in (os.listdir(dir_by_date / depth1)) - assert not (dir_by_date / ".status").exists()