diff --git a/userscript/manga-bookmark.user.js b/userscript/manga-bookmark.user.js index 5cae976..2e3107e 100644 --- a/userscript/manga-bookmark.user.js +++ b/userscript/manga-bookmark.user.js @@ -554,7 +554,15 @@ } ok = true; } catch (e) { - queueEnqueue(key, "put", withStatus, e); + // Same guard as the success path: a newer write is parked for this key, so + // classifying *this* failure would clobber its op or, on a 400, drop it + // outright. Its own drain reports its own outcome. The one thing that must + // still carry across is sendStatus — this flight may have been the archive + // replay, and losing its flag here would narrow the parked write into a + // silent un-archive. + const parked = inFlight.get(key) ? queueGet(key) : null; + if (parked) queueDefer(key, parked.op, withStatus); + else queueEnqueue(key, "put", withStatus, e); } finally { inFlight.delete(key); } @@ -576,7 +584,7 @@ if (!inFlight.get(key)) queueDrop(key); return true; } catch (e) { - queueEnqueue(key, "delete", false, e); + if (!inFlight.get(key)) queueEnqueue(key, "delete", false, e); // see pushBookmark return false; } finally { inFlight.delete(key);