(queuedAt: Date)
| 48 | let databaseScheduleStartTurn: Promise<void> | null = null |
| 49 | |
| 50 | const dueFilter = (queuedAt: Date) => |
| 51 | and( |
| 52 | isNull(workflowSchedule.archivedAt), |
| 53 | lte(workflowSchedule.nextRunAt, queuedAt), |
| 54 | sql`${workflowSchedule.status} NOT IN ('disabled', 'completed')`, |
| 55 | or( |
| 56 | isNull(workflowSchedule.lastQueuedAt), |
| 57 | lt(workflowSchedule.lastQueuedAt, workflowSchedule.nextRunAt), |
| 58 | lt(workflowSchedule.lastQueuedAt, new Date(queuedAt.getTime() - STALE_SCHEDULE_CLAIM_MS)) |
| 59 | ) |
| 60 | ) |
| 61 | |
| 62 | const activeWorkflowDeploymentFilter = () => |
| 63 | sql`${workflowSchedule.deploymentVersionId} = (select ${workflowDeploymentVersion.id} from ${workflowDeploymentVersion} where ${workflowDeploymentVersion.workflowId} = ${workflowSchedule.workflowId} and ${workflowDeploymentVersion.isActive} = true)` |
no outgoing calls
no test coverage detected