mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 21:59:38 +01:00
fix(server): settle routine status from committed work
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
76fde891cc
commit
dd49318d55
15 files changed
+475
-54
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import type { createDeliveryWorkCoordinator } from "./delivery-work-coordinator.js";
|
||||
import { DELIVERY_QUEUES } from "./delivery-work-notifications.js";
|
||||
import { registerScopedDeadlineWork } from "./scoped-deadline-work.js";
|
||||
import type { routineExecutionStatusService } from "./routine-run-status.js";
|
||||
|
||||
export function registerRoutineExecutionStatusWork(
|
||||
coordinator: ReturnType<typeof createDeliveryWorkCoordinator>,
|
||||
service: ReturnType<typeof routineExecutionStatusService>,
|
||||
canRun: () => boolean,
|
||||
) {
|
||||
return registerScopedDeadlineWork(coordinator, {
|
||||
queue: DELIVERY_QUEUES.routineExecutionStatus,
|
||||
decodeScope: hint => hint === "*" ? undefined : hint,
|
||||
matches: (entry, issueId?: string) => issueId === undefined || entry.issueId === issueId,
|
||||
load: async (issueId?: string) => (await service.load(issueId)).map(row => ({ ...row, dueAt: Date.now() })),
|
||||
check: async entry => { await service.settle(entry); return null; },
|
||||
}, canRun);
|
||||
}
|
||||
Reference in new issue
Block a user