fix(scheduler): drain pending wakeup requests
This commit is contained in:
1 parent
749ad3a231
commit
49ea508ee1
3 files changed
+191
-4
No files matched your search
@@ -159,6 +159,17 @@ export function buildWakeupMethods(
|
||||
return promoted;
|
||||
},
|
||||
|
||||
listPendingWakeupAgents(companyId: string): Array<{ agentId: string }> {
|
||||
return readAll(
|
||||
`SELECT agent_id AS agentId
|
||||
FROM wakeup_requests
|
||||
WHERE company_id = ? AND status IN ('queued', 'deferred')
|
||||
GROUP BY agent_id
|
||||
ORDER BY MIN(requested_at) ASC`,
|
||||
companyId,
|
||||
);
|
||||
},
|
||||
|
||||
listWakeupRequests(companyId: string, filters?: { status?: string; agentId?: string; limit?: number }): Array<{
|
||||
id: string; companyId: string; agentId: string; source: string; triggerDetail: string | null;
|
||||
status: string; coalescedCount: number; runId: string | null; requestedAt: string;
|
||||
|
||||
Reference in new issue
Block a user