MCPcopy Index your code
hub / github.com/simstudioai/sim / dueFilter

Function dueFilter

apps/sim/app/api/schedules/execute/route.ts:50–60  ·  view source on GitHub ↗
(queuedAt: Date)

Source from the content-addressed store, hash-verified

48let databaseScheduleStartTurn: Promise<void> | null = null
49
50const 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
62const activeWorkflowDeploymentFilter = () =>
63 sql`${workflowSchedule.deploymentVersionId} = (select ${workflowDeploymentVersion.id} from ${workflowDeploymentVersion} where ${workflowDeploymentVersion.workflowId} = ${workflowSchedule.workflowId} and ${workflowDeploymentVersion.isActive} = true)`

Callers 2

workflowScheduleFilterFunction · 0.85
jobScheduleFilterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected