Describe the bug
docs/advanced-guide/using-cron/page.md contradicts itself about whether cron jobs can run more than once a minute, and the sentence that is wrong is the one a reader is most likely to act on.
:39 states:
The minimum time difference between cron job's two consecutive runs is a minute as it is the least significant scheduling time parameter.
Ten lines above, :29-31 documents the optional leading second field:
GoFr also allows an optional field for second as first part in the schedule format, like in the following format:
second minute hour day_of_month month day_of_week
and the page's own example at :77 uses it:
// Run the cron job every 10 seconds(*/10)
app.AddCronJob("*/10 * * * * *", "", func(ctx *gofr.Context) {
ctx.Logger.Infof("current time is %v", time.Now())
})
So the page tells you sub-minute scheduling is impossible, then demonstrates it.
Which one is correct
The second field is real; :39 is the stale sentence. In pkg/gofr/cron.go:
NewCron ticks once per second — ticker: time.NewTicker(time.Second) (cron.go:73) — so the scheduler is evaluated at second granularity, not minute.
- Both schedule lengths are supported constants:
scheduleParts = 5 and schedulePartsWithSecond = 6 (cron.go:22-23).
job carries a sec field alongside min/hour/… (cron.go:51), and seconds = 59 bounds it (cron.go:17).
:39 looks like it predates the second field and was never removed when that field was added.
Expected behavior
:39 should say the minimum gap is one second when the optional leading second field is used, and one minute with the 5-field form (where second defaults such that the job fires once per minute). Suggested replacement:
With the 5-field format the minimum time difference between a cron job's two consecutive runs is a minute, since minute is then the least significant scheduling parameter. Adding the optional leading second field lowers that to a second — GoFr's scheduler ticks every second.
More description
Pre-existing and unrelated to any in-flight change; surfaced during review of #3815, which touched docs/guides/graceful-shutdown/page.md and deliberately left this out of scope. Docs-only — no code change is implied, since the code already behaves as the second field documents.
Describe the bug
docs/advanced-guide/using-cron/page.mdcontradicts itself about whether cron jobs can run more than once a minute, and the sentence that is wrong is the one a reader is most likely to act on.:39states:Ten lines above,
:29-31documents the optional leadingsecondfield:and the page's own example at
:77uses it:So the page tells you sub-minute scheduling is impossible, then demonstrates it.
Which one is correct
The
secondfield is real;:39is the stale sentence. Inpkg/gofr/cron.go:NewCronticks once per second —ticker: time.NewTicker(time.Second)(cron.go:73) — so the scheduler is evaluated at second granularity, not minute.scheduleParts = 5andschedulePartsWithSecond = 6(cron.go:22-23).jobcarries asecfield alongsidemin/hour/… (cron.go:51), andseconds = 59bounds it (cron.go:17).:39looks like it predates thesecondfield and was never removed when that field was added.Expected behavior
:39should say the minimum gap is one second when the optional leadingsecondfield is used, and one minute with the 5-field form (whereseconddefaults such that the job fires once per minute). Suggested replacement:More description
Pre-existing and unrelated to any in-flight change; surfaced during review of #3815, which touched
docs/guides/graceful-shutdown/page.mdand deliberately left this out of scope. Docs-only — no code change is implied, since the code already behaves as thesecondfield documents.