mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(jobs): classify BullMQ stall (UnrecoverableError) as operational (#610)
BullMQ raises UnrecoverableError when a job loses its lock (a stall), e.g. a heavy upscale under memory pressure. We never throw it ourselves, so classifyError now treats it as operational (one warning per hour) instead of a bug. ReplyError stays a bug.
This commit is contained in:
@@ -99,6 +99,18 @@ describe("classifyError", () => {
|
||||
expect(classifyError(e, "http")).toBe("expected");
|
||||
expect(classifyError(e)).toBe("expected");
|
||||
});
|
||||
it("operational: a BullMQ UnrecoverableError (stalled/lock-lost job) is a strained instance, not our bug", () => {
|
||||
// BullMQ raises UnrecoverableError from its own worker loop when a job loses
|
||||
// its lock (a stall), e.g. a heavy `upscale` under CPU/memory pressure. We
|
||||
// never throw it ourselves, so it always means the instance could not keep
|
||||
// the job's lock alive -- environmental, worth one warning/hour not bug spam
|
||||
// (NODE-27). A ReplyError (a real Redis command failure) stays a bug.
|
||||
const stalled = Object.assign(new Error("Missing lock for job 42. moveToFinished"), {
|
||||
name: "UnrecoverableError",
|
||||
});
|
||||
expect(classifyError(stalled, "worker")).toBe("operational");
|
||||
expect(classifyError(stalled)).toBe("operational");
|
||||
});
|
||||
});
|
||||
|
||||
describe("throttle", () => {
|
||||
|
||||
Reference in New Issue
Block a user