Summary
PeerStorage.delete() catches all exceptions from Deno.remove() and logs "delete failed" at LOG_LEVEL_NOTICE, returning false. When CouchDB tombstones arrive for paths that were already removed while the bridge was down (or never existed on this host), ENOENT is expected — the file is already gone. Treating it as a failure spams the log and returns false to the caller, which may affect downstream retry logic.
Reproduction
- Delete a file on machine A while the bridge on machine B is down.
- Start the bridge on machine B.
- The CouchDB change feed delivers a tombstone for the deleted path.
PeerStorage.delete() calls Deno.remove() → ENOENT → logs "delete failed" at NOTICE level.
Fix
Catch Deno.errors.NotFound specifically and return true — the file is already absent, which is the desired end state.
async delete(pathSrc: string): Promise<boolean> {
try {
await Deno.remove(path);
this.receiveLog(\` ${path} deleted\`);
} catch (ex) {
+ if (ex instanceof Deno.errors.NotFound) {
+ this.receiveLog(\` ${path} already absent\`);
+ return true;
+ }
this.receiveLog(\` ${path} delete failed\`, LOG_LEVEL_NOTICE);
Logger(ex, LOG_LEVEL_VERBOSE);
return false;
}
}
Summary
PeerStorage.delete()catches all exceptions fromDeno.remove()and logs "delete failed" atLOG_LEVEL_NOTICE, returningfalse. When CouchDB tombstones arrive for paths that were already removed while the bridge was down (or never existed on this host),ENOENTis expected — the file is already gone. Treating it as a failure spams the log and returnsfalseto the caller, which may affect downstream retry logic.Reproduction
PeerStorage.delete()callsDeno.remove()→ENOENT→ logs "delete failed" at NOTICE level.Fix
Catch
Deno.errors.NotFoundspecifically and returntrue— the file is already absent, which is the desired end state.async delete(pathSrc: string): Promise<boolean> { try { await Deno.remove(path); this.receiveLog(\` ${path} deleted\`); } catch (ex) { + if (ex instanceof Deno.errors.NotFound) { + this.receiveLog(\` ${path} already absent\`); + return true; + } this.receiveLog(\` ${path} delete failed\`, LOG_LEVEL_NOTICE); Logger(ex, LOG_LEVEL_VERBOSE); return false; } }