diff --git a/services/arbiter-3.0/src/lib/ptero-sync.js b/services/arbiter-3.0/src/lib/ptero-sync.js index 4f228f8..ac5a800 100644 --- a/services/arbiter-3.0/src/lib/ptero-sync.js +++ b/services/arbiter-3.0/src/lib/ptero-sync.js @@ -100,19 +100,23 @@ async function auditServerSchedules(serverId, serverName) { const res = await axios.get(pteroUrl, { headers: getHeaders() }); const schedules = res.data.data || []; + // Find ANY schedule not created by Trinity const rogueSchedules = schedules .filter(s => !s.attributes.name.startsWith('[Trinity]')) - .filter(s => { - // Check if it looks like a restart schedule - const tasks = s.attributes.relationships?.tasks?.data || []; - return tasks.some(t => t.attributes?.action === 'power'); - }) .map(s => ({ id: s.attributes.id, name: s.attributes.name, - cron: `${s.attributes.minute} ${s.attributes.hour} * * *` + cron: `${s.attributes.minute} ${s.attributes.hour} * * *`, + isActive: s.attributes.is_active })); + return { serverId, serverName, rogueSchedules }; + } catch (err) { + console.error(`Audit failed for ${serverName}:`, err.message); + return { serverId, serverName, rogueSchedules: [], error: err.message }; + } +} + return { serverId, serverName, rogueSchedules }; } catch (err) { return { serverId, serverName, rogueSchedules: [], error: err.message };