mirror of https://github.com/go-co-op/gocron.git
docs: clarify NextRun/NextRuns require scheduler to be started (#910)
* Initial plan * docs: clarify NextRun and NextRuns return empty values until scheduler is started Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com> * docs: remove unhelpful inline comments from NextRun/NextRuns examples Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com> Agent-Logs-Url: https://github.com/go-co-op/gocron/sessions/9686e808-ae5e-4bc8-ad00-f78a1a7b079d * docs: restore inline comments for NextRun/NextRuns examples Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com> Agent-Logs-Url: https://github.com/go-co-op/gocron/sessions/df5afb1e-5c66-4615-9967-a2efc2419d87 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JohnRoesler <19351306+JohnRoesler@users.noreply.github.com>
This commit is contained in:
parent
102b2b2c8e
commit
5b307f56dd
|
|
@ -267,6 +267,9 @@ func ExampleJob_nextRun() {
|
|||
),
|
||||
)
|
||||
|
||||
// NextRun is only available after the scheduler has been started.
|
||||
s.Start()
|
||||
|
||||
nextRun, _ := j.NextRun()
|
||||
fmt.Println(nextRun)
|
||||
}
|
||||
|
|
@ -284,6 +287,9 @@ func ExampleJob_nextRuns() {
|
|||
),
|
||||
)
|
||||
|
||||
// NextRuns is only available after the scheduler has been started.
|
||||
s.Start()
|
||||
|
||||
nextRuns, _ := j.NextRuns(5)
|
||||
fmt.Println(nextRuns)
|
||||
}
|
||||
|
|
|
|||
4
job.go
4
job.go
|
|
@ -1190,8 +1190,12 @@ type Job interface {
|
|||
// Name returns the name defined on the job.
|
||||
Name() string
|
||||
// NextRun returns the time of the job's next scheduled run.
|
||||
// This value is only available once the scheduler has been started
|
||||
// with Scheduler.Start(). Before that, it returns the zero time value.
|
||||
NextRun() (time.Time, error)
|
||||
// NextRuns returns the requested number of calculated next run values.
|
||||
// These values are only available once the scheduler has been started
|
||||
// with Scheduler.Start(). Before that, it returns nil.
|
||||
NextRuns(int) ([]time.Time, error)
|
||||
// RunNow runs the job once, now. This does not alter
|
||||
// the existing run schedule, and will respect all job
|
||||
|
|
|
|||
Loading…
Reference in New Issue