Complete implementation of staggered restart scheduler for Trinity Console. Database: - global_restart_config: Node-wide settings (TX1 @ 04:00 UTC, NC1 @ 04:30 UTC) - server_restart_schedules: Per-server state with sort order - sync_logs: Audit trail for all sync operations Backend: - src/utils/scheduler.js: Stagger calculation with date-fns - src/lib/ptero-sync.js: Pterodactyl API integration (create/update/delete/audit) - src/routes/admin/scheduler.js: All CRUD + import + sync + audit routes Frontend: - Drag-and-drop server ordering (SortableJS) - Per-node config cards with base time + interval - Audit modal to detect and nuke rogue schedules - Skip toggle for maintenance mode - Visual sync status indicators Features: - Import servers from Pterodactyl discovery - Recalculate effective times on reorder - Rate-limited API calls (200ms delay) - [Trinity] Daily Restart naming convention Signed-off-by: Claude (Chronicler #61) <claude@firefrostgaming.com>
13 lines
376 B
JavaScript
13 lines
376 B
JavaScript
const { addMinutes, format, parse } = require('date-fns');
|
|
|
|
function calculateStagger(baseTime, interval, servers) {
|
|
const start = parse(baseTime, 'HH:mm:ss', new Date());
|
|
|
|
return servers.map((server, index) => ({
|
|
...server,
|
|
effective_time: format(addMinutes(start, index * interval), 'HH:mm:ss')
|
|
}));
|
|
}
|
|
|
|
module.exports = { calculateStagger };
|