Skip to content

Schedules: carry Cacti core scheduler fixes into FlowView (zero interval loop, epoch start, drift, week length, picker timezone) #347

In review

Description

@TheWitness

Summary

Cacti core's lib/api_scheduler.php on develop has picked up several scheduler correctness fixes over the last few months (Cacti/cacti#7568, #9063, #9153, #7995, #8991, #8739; see also #9241). FlowView has its own interval-based scheduler (flowview_schedules.php → plugin_flowview_schedules.sendinterval/lastsent → flowview_process.php → run_schedule.php), and none of those fixes were carried over. This issue tracks the parity gaps. They are not covered by #331, #321/#322 or #323/#324.

Core scheduler vs. FlowView scheduler

Area Core api_scheduler.php (develop) FlowView (develop, dc9cd4f)
Zero/negative recurrence max(1, (int) recur_every) guard (#9063) save_schedules() runs while ($d < $t) { $d += $i; } with $i = sendinterval taken straight from the request. sendinterval=0 hangs the request in an endless loop; if it is stored, flowview_process.php ($t - sendinterval > lastsent) queues the report on every poller cycle.
Advancing a stale schedule Advances in whole intervals with floor(($now - $target) / $recur) (#9063) Steps one interval at a time in a while loop. run_schedule.php then overwrites lastsent with the actual run time, so every send drifts by however late the poller picked it up, and a manual Send Now shifts the whole schedule.
Unparsable or empty start time Strict === false guards; an unschedulable entry never resolves to 1970 (#7568, #9241) strtotime(start) is not checked. An empty or invalid Scheduled Base Time becomes false/0 and the loop counts forward from the 1970 epoch.
Week length $week = $day * 7 "Every Week" = 432000 (5 days), "Every 2 Weeks" = 864000 (10 days), "Every Month" = 1728000 (20 days).
Date/time picker timezone timezone: <?php print intval(date('Z') / 60); ?> so the picker's Now matches server wall time (#9153, #7995) The #start datetimepicker has no timezone option, so Now uses the browser's offset while the value is stored and evaluated as server wall time.
JS string encoding json_encode(__()) (#8991) Already compliant in the schedule editor. No gap.
raise_message() escaping __() rather than __esc() (#8739) Already compliant. No gap.

Expected

  • A schedule with a send interval that isn't in the list, or a start time that can't be parsed, is refused and not stored.
  • The initial lastsent anchor is computed arithmetically, never from the epoch.
  • After a run, lastsent advances to the latest scheduled slot at or before the run time, so sends stay on the configured base time and a manual Send Now does not move the schedule.
  • Week, two-week and month intervals are 7, 14 and 30 days. Existing rows are migrated on upgrade.
  • The schedule datetimepicker uses the server offset.

Activity

  1. added a commit that references this issue on Dec 5, 2026
    4ed1af4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions