diff --git a/harbor/queue.py b/harbor/queue.py index 4c69984..1949c22 100644 --- a/harbor/queue.py +++ b/harbor/queue.py @@ -47,8 +47,12 @@ class FunctionQueue: m = re.match(r"([0-9A-F]{6,8})_", path.name) if not m: continue - with path.open(encoding="utf-8", errors="replace") as f: - head = [next(f, "") for _ in range(8)] + try: + with path.open(encoding="utf-8", errors="replace") as f: + head = [next(f, "") for _ in range(8)] + except (FileNotFoundError, PermissionError): + continue # a landing on main moved or rewrote it while we scanned; its new path is found + status = "readable" if any(line.startswith(READABLE) for line in head) else \ next((line.split("status:", 1)[1].strip() for line in head if "status:" in line), "raw") out[int(m.group(1), 16)] = (status, path.name)