Password Policy/App rename/PM Scheduling Improvements
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
const { createApp } = require('./app');
|
||||
const { runAlertCycle } = require('./services/alerts');
|
||||
const { runScheduledSync } = require('./services/workday');
|
||||
const { runScheduledRecompute } = require('./services/pm');
|
||||
|
||||
const PORT = Number(process.env.PORT || process.env.MIXEDASSETS_PORT || 3000);
|
||||
const PORT = Number(process.env.PORT || process.env.DEPRECORE_PORT || 3000);
|
||||
const app = createApp();
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`MixedAssets API listening on http://localhost:${PORT}`);
|
||||
console.log(`DepreCore API listening on http://localhost:${PORT}`);
|
||||
});
|
||||
|
||||
// Periodically scan for due/expiring items and email digests. These are no-ops
|
||||
@@ -24,5 +25,20 @@ function scheduleWorkdaySync() {
|
||||
setInterval(tick, 60 * 60 * 1000).unref();
|
||||
}
|
||||
|
||||
// Hourly tick that lets the PM recompute job self-gate to its configured nightly hour. Keeps dynamic
|
||||
// (usage/lifespan) due-dates fresh for schedules that aren't completed or read between runs.
|
||||
function schedulePmRecompute() {
|
||||
const tick = () => {
|
||||
try {
|
||||
runScheduledRecompute();
|
||||
} catch (error) {
|
||||
console.error('PM recompute failed:', error.message);
|
||||
}
|
||||
};
|
||||
setTimeout(tick, 90_000).unref();
|
||||
setInterval(tick, 60 * 60 * 1000).unref();
|
||||
}
|
||||
|
||||
scheduleAlertCycle();
|
||||
scheduleWorkdaySync();
|
||||
schedulePmRecompute();
|
||||
|
||||
Reference in New Issue
Block a user