Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ void shedsStaleJobsUnderOverload(@TempDir Path dir) throws Exception {
Thread.sleep(100);
}

// A job can be shed between the dead-letter read and the stats
// read that satisfied the exit condition; once converged nothing
// moves, so a fresh dead-letter read gives the settled count.
codelDead = queue.listDead(100, 0).stream()
.filter(d -> d.error != null && d.error.startsWith("codel:"))
.count();

assertTrue(codelDead >= 1, "sustained overload should shed at least one stale job");
assertEquals(codelDead, stats.dead, "every dead job is a CoDel drop");
assertEquals(total, stats.completed + stats.dead, "no job is lost");
Expand Down
6 changes: 6 additions & 0 deletions sdks/node/test/core/codel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ it("sheds stale jobs to the DLQ under sustained overload", async () => {
await sleep(100);
}

// A job can be shed between the dead-letter read and the stats read that
// satisfied the exit condition; once converged nothing moves, so a fresh
// dead-letter read gives the settled count.
const dead = await queue.deadLetters(100);
codelDead = dead.filter((d) => (d.error ?? "").startsWith("codel:")).length;

expect(codelDead).toBeGreaterThanOrEqual(1);
// Every dead job is a CoDel drop (the task never throws), and nothing is lost.
expect(stats.dead).toBe(codelDead);
Expand Down
5 changes: 5 additions & 0 deletions sdks/python/tests/core/test_codel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def slow() -> None:
if stats["completed"] + stats["dead"] == total and len(codel_dead) >= 1:
break
time.sleep(0.1)
# A job can be shed between the dead-letter read and the stats read
# that satisfied the exit condition; once converged nothing moves, so
# a fresh dead-letter read gives the settled count.
dead = q.dead_letters(limit=100)
codel_dead = [d for d in dead if str(d.get("error", "")).startswith("codel:")]
finally:
q.shutdown()
worker.join(timeout=5)
Expand Down
Loading