(schedule: Schedule)
| 14 | import { spawnAsync } from "../process/spawnAsync"; |
| 15 | |
| 16 | export const scheduleJob = (schedule: Schedule) => { |
| 17 | const { cronExpression, scheduleId, timezone } = schedule; |
| 18 | |
| 19 | // Use timezone from schedule, default to UTC if not specified |
| 20 | const tz = timezone || "UTC"; |
| 21 | |
| 22 | scheduleJobNode( |
| 23 | scheduleId, |
| 24 | { |
| 25 | tz, |
| 26 | rule: cronExpression, |
| 27 | }, |
| 28 | async () => { |
| 29 | await runCommand(scheduleId); |
| 30 | }, |
| 31 | ); |
| 32 | }; |
| 33 | |
| 34 | export const removeScheduleJob = (scheduleId: string) => { |
| 35 | const currentJob = scheduledJobs[scheduleId]; |
no test coverage detected