Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.2 KiB
Plaintext
1 line
2.2 KiB
Plaintext
{"version":3,"sources":["../../../src/queues/errors/getWorkflowRetryBehavior.ts"],"sourcesContent":["import type { Job } from '../../index.js'\nimport type { RetryConfig } from '../config/types/taskTypes.js'\n\nimport { calculateBackoffWaitUntil } from './calculateBackoffWaitUntil.js'\n\n/**\n * Assuming there is no task that has already reached max retries,\n * this function determines if the workflow should retry the job\n * and if so, when it should retry.\n */\nexport function getWorkflowRetryBehavior({\n job,\n retriesConfig,\n}: {\n job: Job\n retriesConfig?: number | RetryConfig\n}):\n | {\n hasFinalError: false\n maxWorkflowRetries?: number\n waitUntil?: Date\n }\n | {\n hasFinalError: true\n maxWorkflowRetries?: number\n waitUntil?: Date\n } {\n const maxWorkflowRetries = (\n typeof retriesConfig === 'object' ? retriesConfig.attempts : retriesConfig\n )!\n\n if (\n maxWorkflowRetries !== undefined &&\n maxWorkflowRetries !== null &&\n job.totalTried >= maxWorkflowRetries\n ) {\n return {\n hasFinalError: true,\n maxWorkflowRetries,\n }\n }\n\n if (!retriesConfig) {\n // No retries provided => assuming no task reached max retries, we can retry\n return {\n hasFinalError: false,\n maxWorkflowRetries: undefined,\n waitUntil: undefined,\n }\n }\n\n // Job will retry. Let's determine when!\n const waitUntil: Date = calculateBackoffWaitUntil({\n retriesConfig,\n totalTried: job.totalTried ?? 0,\n })\n\n return {\n hasFinalError: false,\n maxWorkflowRetries,\n waitUntil,\n }\n}\n"],"names":["calculateBackoffWaitUntil","getWorkflowRetryBehavior","job","retriesConfig","maxWorkflowRetries","attempts","undefined","totalTried","hasFinalError","waitUntil"],"mappings":"AAGA,SAASA,yBAAyB,QAAQ,iCAAgC;AAE1E;;;;CAIC,GACD,OAAO,SAASC,yBAAyB,EACvCC,GAAG,EACHC,aAAa,EAId;IAWC,MAAMC,qBACJ,OAAOD,kBAAkB,WAAWA,cAAcE,QAAQ,GAAGF;IAG/D,IACEC,uBAAuBE,aACvBF,uBAAuB,QACvBF,IAAIK,UAAU,IAAIH,oBAClB;QACA,OAAO;YACLI,eAAe;YACfJ;QACF;IACF;IAEA,IAAI,CAACD,eAAe;QAClB,4EAA4E;QAC5E,OAAO;YACLK,eAAe;YACfJ,oBAAoBE;YACpBG,WAAWH;QACb;IACF;IAEA,wCAAwC;IACxC,MAAMG,YAAkBT,0BAA0B;QAChDG;QACAI,YAAYL,IAAIK,UAAU,IAAI;IAChC;IAEA,OAAO;QACLC,eAAe;QACfJ;QACAK;IACF;AACF"} |