Offline retry queue for userscript writes #5
@@ -554,7 +554,15 @@
|
|||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
} catch (e) {
|
} 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 {
|
} finally {
|
||||||
inFlight.delete(key);
|
inFlight.delete(key);
|
||||||
}
|
}
|
||||||
@@ -576,7 +584,7 @@
|
|||||||
if (!inFlight.get(key)) queueDrop(key);
|
if (!inFlight.get(key)) queueDrop(key);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
queueEnqueue(key, "delete", false, e);
|
if (!inFlight.get(key)) queueEnqueue(key, "delete", false, e); // see pushBookmark
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
inFlight.delete(key);
|
inFlight.delete(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user