MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / updateScheduleAfterRun

Function updateScheduleAfterRun

packages/server/src/services/schedule/index.ts:184–197  ·  view source on GitHub ↗
(
    appDataSource: DataSource,
    scheduleRecordId: string,
    cronExpression: string,
    timezone: string = 'UTC'
)

Source from the content-addressed store, hash-verified

182// ---------------------------------------------------------------------------
183
184const updateScheduleAfterRun = async (
185 appDataSource: DataSource,
186 scheduleRecordId: string,
187 cronExpression: string,
188 timezone: string = 'UTC'
189): Promise<void> => {
190 try {
191 const lastRunAt = new Date()
192 const nextRunAt = computeNextRunAt(cronExpression, timezone, lastRunAt) ?? undefined
193 await appDataSource.getRepository(ScheduleRecord).update({ id: scheduleRecordId }, { lastRunAt, nextRunAt })
194 } catch (error) {
195 logger.error(`[ScheduleService]: updateScheduleAfterRun failed for ${scheduleRecordId}: ${getErrorMessage(error)}`)
196 }
197}
198
199/**
200 * Returns the current schedule record and whether it can be enabled,

Callers

nothing calls this directly

Calls 3

computeNextRunAtFunction · 0.90
getErrorMessageFunction · 0.90
updateMethod · 0.65

Tested by

no test coverage detected