docs: call them scheduled events, the way the editor already does

This commit is contained in:
hugocasa
2026-08-28 17:43:48 +02:00
parent cba60d6e18
commit fbae14a1c3
4 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -1010,8 +1010,8 @@ pub struct ScheduleWJobs {
pub queues_next_run_at_start: bool,
}
/// Occurrences to look ahead over when sizing the interval.
const INTERVAL_SAMPLE_SLOTS: usize = 5;
/// Scheduled events to look ahead over when sizing the interval.
const INTERVAL_SAMPLE_EVENTS: usize = 5;
/// The *shortest* gap, not the average: under an irregular expression a run can
/// outlast the tight gaps while still fitting inside the mean, and it is the
@@ -1023,8 +1023,8 @@ fn configured_interval_s(
) -> Option<i64> {
let tz = chrono_tz::Tz::from_str(timezone).ok()?;
let cron = ScheduleType::from_str(schedule, cron_version, false).ok()?;
let slots = cron.upcoming(tz, INTERVAL_SAMPLE_SLOTS).ok()?;
slots
let events = cron.upcoming(tz, INTERVAL_SAMPLE_EVENTS).ok()?;
events
.windows(2)
.map(|pair| (pair[1] - pair[0]).num_seconds())
.min()
@@ -1753,7 +1753,7 @@ mod tests {
use super::*;
/// Twice a day, so the gaps alternate 8 hours and 16. A run only has to
/// outlast the shorter one to start skipping slots, so that is the number
/// outlast the shorter one to start skipping events, so that is the number
/// the interval has to be.
#[test]
fn interval_is_the_shortest_gap_an_irregular_cron_leaves() {
@@ -5,9 +5,9 @@ const runs = (duration_ms: number) => Array.from({ length: 5 }, () => ({ duratio
// Each exemption below is a schedule that is genuinely running less often than
// its cron reads, and is still not something to report. Losing one of them turns
// the badge into noise on a correctly configured schedule.
// the warning into noise on a correctly configured schedule.
describe('runsOutlastingInterval', () => {
it('reports how long runs that outlast the gap between slots are taking', () => {
it('reports how long runs that outlast the gap between events are taking', () => {
expect(runsOutlastingInterval({ enabled: true, interval_s: 20, jobs: runs(50_000) })).toBe(
50_000
)
@@ -10,11 +10,11 @@ export type ScheduleRunsSample = {
/**
* How long a schedule's runs have been taking, when that is longer than the gap
* between its slots, and `undefined` otherwise.
* between its scheduled events, and `undefined` otherwise.
*
* A plain script schedule queues its next run only once the previous one has
* completed, so a run that outlasts the interval necessarily pushes the next one
* to a later slot: the schedule quietly runs less often than its cron says.
* to a later event: the schedule quietly runs less often than its cron says.
* Schedules that queue the next run as the previous one starts are exempt, and
* the server says which those are.
*/
@@ -946,7 +946,7 @@
<Alert type="warning" size="xs" title="Runs are outlasting the interval">
Recent runs have been taking about {msToReadableTimeShort(outlastingMs, 0)}, against {msToReadableTime(
runsSample.interval_s * 1000
)} between slots. Script runs never overlap, so the next run is only queued once the
)} between scheduled events. Script runs never overlap, so the next run is only queued once the
previous one has completed: this schedule is running less often than its cron asks
for. To keep the cadence, schedule a flow instead, which queues its next run when the
previous one starts.