record last finished timestamp for failures
This commit is contained in:
1 parent
10174da4f0
commit
9db4e557b3
3 files changed
+3
-1
No files matched your search
@@ -127,6 +127,7 @@ class MongoJobsRepository implements IJobsRepository {
|
|||||||
nextScheduledAt: now + BACKOFF_MS,
|
nextScheduledAt: now + BACKOFF_MS,
|
||||||
lockedBy: null, // Remove lock
|
lockedBy: null, // Remove lock
|
||||||
lockedUntil: null,
|
lockedUntil: null,
|
||||||
|
lastFinishedAt: now, // a failed run still finished used in getMetrics for failedAt timestamp
|
||||||
lastFailReason: error instanceof Error ? error.message : String(error),
|
lastFailReason: error instanceof Error ? error.message : String(error),
|
||||||
},
|
},
|
||||||
$inc: {
|
$inc: {
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ describe("MongoJobsRepository", () => {
|
|||||||
const row = await readRow("check:mon-1");
|
const row = await readRow("check:mon-1");
|
||||||
expect(row?.nextScheduledAt).toBe(NOW + BACKOFF_MS);
|
expect(row?.nextScheduledAt).toBe(NOW + BACKOFF_MS);
|
||||||
expect(row?.lastFailReason).toBe("connection refused");
|
expect(row?.lastFailReason).toBe("connection refused");
|
||||||
|
expect(row?.lastFinishedAt).toBe(NOW);
|
||||||
expect(row?.failCount).toBe(3);
|
expect(row?.failCount).toBe(3);
|
||||||
expect(row?.lockedBy).toBeNull();
|
expect(row?.lockedBy).toBeNull();
|
||||||
expect(row?.lockedUntil).toBeNull();
|
expect(row?.lockedUntil).toBeNull();
|
||||||
|
|||||||
@@ -680,7 +680,7 @@ describe("DBQueueWorker", () => {
|
|||||||
|
|
||||||
expect(page.count).toBe(1);
|
expect(page.count).toBe(1);
|
||||||
expect(page.jobs).toHaveLength(1);
|
expect(page.jobs).toHaveLength(1);
|
||||||
expect(page.jobs[0]).toEqual(expect.objectContaining({ monitorId: "m1", monitorType: "check", monitorInterval: 60000, repeat: 60000 }));
|
expect(page.jobs[0]).toEqual(expect.objectContaining({ monitorId: "m1", monitorType: "check", monitorInterval: 60000 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("falls back to the job id for monitorId when refId is null (global jobs)", async () => {
|
it("falls back to the job id for monitorId when refId is null (global jobs)", async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user