Skip to content

Commit b396f46

Browse files
authored
Merge pull request #3327 from trycompai/main
[comp] Production Deploy
2 parents fb7227d + 1d44d64 commit b396f46

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎apps/api/src/trigger/evidence-export/export-organization-evidence.spec.ts‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,29 @@ jest.mock('@/tasks/evidence-export/evidence-attachment-streamer', () => ({
6666
createFilenameTracker: jest.fn(),
6767
}));
6868

69-
import { streamArchiveToS3 } from './export-organization-evidence';
69+
import {
70+
exportOrganizationEvidenceTask,
71+
streamArchiveToS3,
72+
} from './export-organization-evidence';
73+
74+
describe('exportOrganizationEvidenceTask config', () => {
75+
// schemaTask is mocked to return its config, so the task IS its config object.
76+
const config = exportOrganizationEvidenceTask as unknown as {
77+
id: string;
78+
maxDuration: number;
79+
};
80+
81+
it('allows large orgs at least an hour before Trigger.dev kills the run', () => {
82+
// Regression: orgs with high automation volume + large outputs exceeded the
83+
// old 30-minute (60 * 30 = 1800s) budget, so Trigger.dev killed the run
84+
// (retry maxAttempts: 0), leaving it in a non-COMPLETED terminal state that
85+
// the browser surfaces as a failed export with no download link. The task
86+
// must be allowed at least an hour to finish streaming the ZIP to S3.
87+
expect(config.maxDuration).toBeGreaterThanOrEqual(60 * 60);
88+
// maxDuration is in SECONDS — guard against the ms form (which would be days).
89+
expect(config.maxDuration).toBeLessThan(24 * 60 * 60);
90+
});
91+
});
7092

7193
describe('streamArchiveToS3', () => {
7294
const s3Client = {} as never;

‎apps/api/src/trigger/evidence-export/export-organization-evidence.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ export const exportOrganizationEvidenceTask = schemaTask({
7171
// concurrencyLimit 1 + a per-org concurrencyKey (passed at trigger time) means
7272
// at most one export runs per org at a time; different orgs still run in parallel.
7373
queue: { name: 'evidence-export', concurrencyLimit: 1 },
74-
maxDuration: 60 * 30,
74+
// maxDuration is max compute time in SECONDS. Orgs with high automation
75+
// volume + large outputs were exceeding the old 30-minute budget, so
76+
// Trigger.dev killed the run (retry maxAttempts: 0) — a non-COMPLETED
77+
// terminal state the browser reports as a failed export with no download
78+
// link. Give the single-threaded stream-to-S3 pass up to an hour to finish.
79+
maxDuration: 60 * 60,
7580
retry: { maxAttempts: 0 },
7681
schema: z.object({
7782
organizationId: z.string(),

0 commit comments

Comments
 (0)