Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x | /** * @module scheduler */ const schedule = require('node-schedule'); const recache = require("../cache/recache"); const config = require("../../config").scheduler; const log = require("../../util/log"); const downloadService = require("../download"); const adminService = require("../admin"); /** * Schedule the 'recacheAll()' task according to the configuration module. */ const scheduleRecache = () => { if (process.env.SCHEDULE_RECACHE === '1') { schedule.scheduleJob(config.recache, /* istanbul ignore next */ async () => { log.info("SCHEDULER: Executing scheduled task 'recacheAll()' at %s...", (new Date).toUTCString()); await recache.recacheAll(); }); } else { log.info("SCHEDULER: SKIPPING scheduling of task 'recacheAll()' due to environment config"); } }; /** * Schedule the 'deleteExportFiles()' task according to the configuration module. */ const scheduleDeleteExportFiles = () => { schedule.scheduleJob(config.deleteExports, /* istanbul ignore next */ async () => { log.info("SCHEDULER: Executing scheduled task 'deleteExportFiles()' at %s...", (new Date).toUTCString()); downloadService.deleteExportFiles(); }); }; /** * Schedule the 'sendSummary()' task according to the configuration module. */ const scheduleWeeklySummary = () => { schedule.scheduleJob(config.weeklySummary, /* istanbul ignore next */ async () => { log.info("SCHEDULER: Executing scheduled task 'scheduleWeeklySummary()' at %s...", (new Date).toUTCString()); adminService.sendSummary(); }); }; /** * Schedule all tasks. */ const scheduleAllTasks = () => { scheduleRecache(); scheduleDeleteExportFiles(); scheduleWeeklySummary(); }; module.exports = { scheduleAllTasks, }; |