( payload: ScheduleExecutionPayload, now: Date, requestId: string )
| 277 | } |
| 278 | |
| 279 | async function determineNextRunAfterError( |
| 280 | payload: ScheduleExecutionPayload, |
| 281 | now: Date, |
| 282 | requestId: string |
| 283 | ) { |
| 284 | try { |
| 285 | const [workflowRecord] = await db |
| 286 | .select() |
| 287 | .from(workflow) |
| 288 | .where(eq(workflow.id, payload.workflowId)) |
| 289 | .limit(1) |
| 290 | |
| 291 | if (workflowRecord?.isDeployed) { |
| 292 | const nextRunAt = await calculateNextRunFromDeployment(payload, requestId) |
| 293 | if (nextRunAt) { |
| 294 | return nextRunAt |
| 295 | } |
| 296 | } |
| 297 | } catch (workflowError) { |
| 298 | logger.error(`[${requestId}] Error retrieving workflow for next run calculation`, workflowError) |
| 299 | } |
| 300 | |
| 301 | return new Date(now.getTime() + 24 * 60 * 60 * 1000) |
| 302 | } |
| 303 | |
| 304 | async function isScheduleDeploymentVersionActive( |
| 305 | workflowId: string, |
no test coverage detected