Skip to content

Commit

Permalink
only drop index caches if necessary;
Browse files Browse the repository at this point in the history
prevents having to rebuild covers due to unrelated changes
  • Loading branch information
9001 committed May 8, 2024
1 parent 1ee2cdd commit e396c5c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions copyparty/up2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,11 @@ def register_vpath(
return None

def _verify_db_cache(self, cur: "sqlite3.Cursor", vpath: str) -> None:
# check if volume config changed since last use; drop caches if so
zsl = [vpath] + list(sorted(self.asrv.vfs.all_vols.keys()))
# check if list of intersecting volumes changed since last use; drop caches if so
prefix = (vpath + "/").lstrip("/")
zsl = [x for x in self.asrv.vfs.all_vols if x.startswith(prefix)]
zsl = [x[len(prefix) :] for x in zsl]
zsl.sort()
zb = hashlib.sha1("\n".join(zsl).encode("utf-8", "replace")).digest()
vcfg = base64.urlsafe_b64encode(zb[:18]).decode("ascii")

Expand Down

0 comments on commit e396c5c

Please sign in to comment.