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

Function determineNextRunAfterError

apps/sim/background/schedule-execution.ts:279–302  ·  view source on GitHub ↗
(
  payload: ScheduleExecutionPayload,
  now: Date,
  requestId: string
)

Source from the content-addressed store, hash-verified

277}
278
279async 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
304async function isScheduleDeploymentVersionActive(
305 workflowId: string,

Callers 2

executeScheduleJobFunction · 0.85

Calls 3

errorMethod · 0.80
eqFunction · 0.50

Tested by

no test coverage detected