UNPKG

integreat

Version:
19 lines 672 B
import { IdentType } from './types.js'; export default (dispatch, jobs) => async function dispatchScheduled(from, to) { const dispatched = []; const meta = { ident: { id: 'scheduler', type: IdentType.Scheduler }, queue: true, }; for (const job of jobs) { if (job && job.schedule) { if (job.schedule.shouldRun(from, to)) { const action = { type: 'RUN', payload: { jobId: job.id }, meta }; const response = await dispatch(action); dispatched.push({ ...action, response }); } } } return dispatched; }; //# sourceMappingURL=dispatchScheduled.js.map