make scheduler setup more robust against wrong scheduling#1202
make scheduler setup more robust against wrong scheduling#1202jokob-sk merged 1 commit intonetalertx:mainfrom
Conversation
is the schedule input is incorrect, an error message is logged and the plugin will NOT run. Creating a dummy schedule would throw the system out of balance as there's the danger of schedules running out of sync.
WalkthroughAdds guarded initialization of plugin schedules when RUN == "schedule": computes schedule via Cron(run_sch).schedule(...), validates non-None before appending to conf.mySchedules, raises ValueError with specific error log on invalid schedules, and adds a catch-all exception handler for unexpected scheduling errors. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Init as initialise.py
participant Cron as Cron(run_sch)
participant Conf as conf.mySchedules
participant Log as Logger
rect rgb(240,245,255)
note over Init: RUN == "schedule"
Init->>Cron: schedule(plugin, offset, ...)
Cron-->>Init: scheduleObj or None / throws
end
alt Valid scheduleObj
Init->>Conf: append(scheduleObj)
Log-->>Init: info: schedule set
else Invalid (None)
Init->>Log: [ERROR] Invalid schedule
Init->>Init: raise ValueError
else Exception thrown
Init->>Log: [ERROR] Unexpected scheduling error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1){server/**/*.py,front/plugins/*/*.py}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧬 Code graph analysis (1)server/initialise.py (3)
🪛 Ruff (0.13.1)server/initialise.py377-377: Abstract (TRY301) 377-377: Avoid specifying long messages outside the exception class (TRY003) 380-380: Do not catch blind exception: (BLE001) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ref: Issue #1199
If the schedule input is incorrect, an error message is logged and the plugin will NOT run. Creating a dummy schedule would throw the system out of balance as there's the danger of schedules running out of sync.
Error message in log:
16:57:20 ["[Config] [ERROR] Invalid schedule '*/2 * * * 5* *' for plugin 'INTRNT'. Error: Invalid cron string format."]The settings screen will also show a warning:

Summary by CodeRabbit