[grade=pending] fix: eliminate CPU waste from duplicate workflows, self-updater crash loop, and aggressive polling
- Remove duplicate WorkflowEngine instantiation (was created in both app.js and server.js, causing every periodic workflow to fire twice) - Fix self-updater _isNewer() crash loop: same-version different-commit was treated as 'update available', then crashed on undefined tarball path. Now only triggers on actual version bumps - Increase container stats interval from 10s to 30s - Increase health check interval from 30s to 60s - Add disk cleanup debounce (skip if last cleanup < 30 min ago) - Remove redundant disk-space-monitor from server.js (already in app.js) - 69/69 tests pass
This commit is contained in:
@@ -460,7 +460,7 @@ async function createApp() {
|
||||
// Initialize config drift detector
|
||||
const driftDetector = new ConfigDriftDetector(ctx);
|
||||
ctx.driftDetector = driftDetector;
|
||||
driftDetector.startPolling(300000); // 5 min
|
||||
driftDetector.startPolling(600000); // 10 min (was 5 min — docker inspect per container is CPU heavy)
|
||||
log.info('app', 'Config drift detector initialized');
|
||||
|
||||
// Initialize SSL monitor
|
||||
@@ -472,7 +472,7 @@ async function createApp() {
|
||||
// Initialize disk space monitor (disk budget + auto-cleanup)
|
||||
const diskSpaceMonitor = new DiskSpaceMonitor({ log, config: ctx.siteConfig });
|
||||
ctx.diskSpaceMonitor = diskSpaceMonitor;
|
||||
diskSpaceMonitor.start(600000); // 10 min
|
||||
diskSpaceMonitor.start(1800000); // 30 min (was 10 min — docker system df is CPU/IO heavy)
|
||||
log.info('app', 'Disk space monitor initialized', { budgetGB: diskSpaceMonitor.getConfig().diskBudgetGB });
|
||||
|
||||
// Initialize DNS propagation checker
|
||||
@@ -1105,7 +1105,7 @@ async function createApp() {
|
||||
app.use('/api', notFoundHandler);
|
||||
app.use(errorMiddleware);
|
||||
|
||||
return { app, log, config: config.siteConfig, licenseManager };
|
||||
return { app, log, config: config.siteConfig, licenseManager, workflowEngine: ctx.workflowEngine };
|
||||
}
|
||||
|
||||
module.exports = { createApp };
|
||||
|
||||
Reference in New Issue
Block a user