* Callback fired by node-cron. Delegates to the shared ScheduleExecutor * with Beat-specific cleanup callbacks.
(scheduleRecordId: string)
| 222 | * with Beat-specific cleanup callbacks. |
| 223 | */ |
| 224 | private async _onCronFire(scheduleRecordId: string): Promise<void> { |
| 225 | const appServer = getRunningExpressApp() |
| 226 | const ctx = { |
| 227 | appDataSource: appServer.AppDataSource, |
| 228 | componentNodes: appServer.nodesPool.componentNodes, |
| 229 | telemetry: appServer.telemetry, |
| 230 | cachePool: appServer.cachePool, |
| 231 | usageCacheManager: appServer.usageCacheManager, |
| 232 | sseStreamer: appServer.sseStreamer, |
| 233 | identityManager: appServer.identityManager |
| 234 | } |
| 235 | |
| 236 | await executeScheduleJob(ctx, scheduleRecordId, { |
| 237 | onRecordNotFoundOrDisabled: () => { |
| 238 | this._removeCronJob(scheduleRecordId) |
| 239 | }, |
| 240 | onRecordExpiredOrInvalid: async (record) => { |
| 241 | record.enabled = false |
| 242 | await appServer.AppDataSource.getRepository(ScheduleRecord).save(record) |
| 243 | this._removeCronJob(record.id) |
| 244 | } |
| 245 | }) |
| 246 | } |
| 247 | } |
no test coverage detected