feat(client-archive): async Documenso voids + next-in-line sales notifications
Post-archive side-effects now run with backpressure: - Documenso envelope voids enqueue to BullMQ documents queue with retry/DLQ - Released berths fan out a "next in line" notification to port users with interests.change_stage; informational only, no auto stage transitions Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,26 @@ export const documentsWorker = new Worker(
|
||||
await processDocumensoPoll();
|
||||
break;
|
||||
}
|
||||
case 'documenso-void': {
|
||||
// Async cleanup of a Documenso envelope. Producers: smart-archive
|
||||
// (when the operator opts to void in-flight envelopes during
|
||||
// client archive). BullMQ retries with exponential backoff per
|
||||
// QUEUE_CONFIGS; permanently-failed jobs land in the DLQ via
|
||||
// the failed-job listener.
|
||||
const { documentId, documensoId, portId } = job.data as {
|
||||
documentId: string;
|
||||
documensoId: string;
|
||||
portId: string;
|
||||
};
|
||||
if (!documensoId) {
|
||||
logger.warn({ documentId }, 'documenso-void: no documensoId, skipping');
|
||||
return;
|
||||
}
|
||||
const { voidDocument } = await import('@/lib/services/documenso-client');
|
||||
await voidDocument(documensoId, portId);
|
||||
logger.info({ documentId, documensoId, portId }, 'Documenso envelope voided');
|
||||
break;
|
||||
}
|
||||
default:
|
||||
logger.warn({ jobName: job.name }, 'Unknown documents job');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user