(
appDataSource: DataSource,
scheduleRecordId: string,
cronExpression: string,
timezone: string = 'UTC'
)
| 182 | // --------------------------------------------------------------------------- |
| 183 | |
| 184 | const 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, |
nothing calls this directly
no test coverage detected