mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
+9
-13
@@ -5,6 +5,11 @@
|
||||
* Same shape as admin.cron.js — each job module exports
|
||||
* { name, schedule, run }, listed in the `jobs` array below.
|
||||
*
|
||||
* All three are settings-backed (see cronRegistry.util.js) —
|
||||
* schedule/enabled state lives in cron_notification_settings
|
||||
* and is configurable from /admin/notifications/settings
|
||||
* without a restart.
|
||||
*
|
||||
* Currently registered:
|
||||
* - userNotifications (cron/jobs/user_notifications.cron.js)
|
||||
* - issueCertificates (cron/jobs/issue_certificates.cron.js)
|
||||
@@ -13,10 +18,10 @@
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jun. 17, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
const cron = require('node-cron');
|
||||
const userNotifications = require('./jobs/user_notifications.cron');
|
||||
const issueCertificates = require('./jobs/issue_certificates.cron');
|
||||
const expireUserTiers = require('./jobs/expire_user_tiers.cron');
|
||||
const { startSettingsBackedJobs } = require('./cronRegistry.util');
|
||||
|
||||
// ─── Registry — add future client-side cron jobs here ────────────────────────
|
||||
const jobs = [
|
||||
@@ -26,17 +31,8 @@ const jobs = [
|
||||
];
|
||||
|
||||
// ─── Boot all registered client-side jobs ─────────────────────────────────────
|
||||
function startClientCronJobs() {
|
||||
const registered = [];
|
||||
jobs.forEach(({ name, schedule, run }) => {
|
||||
if (!cron.validate(schedule)) {
|
||||
console.error(`[CRON][CLIENT] Invalid schedule for "${name}": "${schedule}" — skipped.`);
|
||||
return;
|
||||
}
|
||||
cron.schedule(schedule, run);
|
||||
registered.push({ name, scope: 'CLIENT', schedule });
|
||||
});
|
||||
return registered;
|
||||
async function startClientCronJobs() {
|
||||
return startSettingsBackedJobs(jobs, 'CLIENT');
|
||||
}
|
||||
|
||||
module.exports = { startClientCronJobs };
|
||||
module.exports = { startClientCronJobs };
|
||||
|
||||
Reference in New Issue
Block a user