mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 21:02:34 +01:00
Reviewed and verified at 11b49125db.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
17 lines
1.1 KiB
TypeScript
17 lines
1.1 KiB
TypeScript
import { DELIVERY_QUEUES, notifyDeliveryWork } from "./delivery-work-notifications.js";
|
|
|
|
/** An issue hint is reserved for local facts such as comments. Lifecycle,
|
|
* graph, run and eligibility changes retain company scope because their
|
|
* consequences can include ancestors and shared execution references. */
|
|
export type IssueRecoveryScope = { companyId: string; issueId?: string };
|
|
|
|
export async function notifyIssueRecovery(transaction: object, scope?: IssueRecoveryScope) {
|
|
const companyHint = scope ? JSON.stringify({ companyId: scope.companyId }) : "*";
|
|
const issueHint = scope ? JSON.stringify({ companyId: scope.companyId, issueId: scope.issueId }) : "*";
|
|
for (const queue of [DELIVERY_QUEUES.orphanBlockers, DELIVERY_QUEUES.activeRecoveryActions, DELIVERY_QUEUES.strandedAssignments, DELIVERY_QUEUES.resolvedDependencies,
|
|
DELIVERY_QUEUES.taskWatchdogs, DELIVERY_QUEUES.staleIssueLocks]) {
|
|
await notifyDeliveryWork(transaction, queue,
|
|
queue === DELIVERY_QUEUES.strandedAssignments || queue === DELIVERY_QUEUES.staleIssueLocks ? issueHint : companyHint);
|
|
}
|
|
}
|