Skip to content

Commit

Permalink
clarify in docs that Every starts immediately (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler committed May 16, 2023
1 parent 708215c commit b94bd7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ If you want to chat, you can find us at Slack!
```golang
s := gocron.NewScheduler(time.UTC)

// Every starts the job immediately and then runs at the
// specified interval
job, err := s.Every(5).Seconds().Do(func(){ ... })
if err != nil {
// handle the error related to setting up the job
Expand Down
2 changes: 2 additions & 0 deletions scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ func (s *Scheduler) EveryRandom(lower, upper int) *Scheduler {
// Interval can be an int, time.Duration or a string that
// parses with time.ParseDuration().
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
//
// The job is run immediately, unless StartAt or At is set.
func (s *Scheduler) Every(interval interface{}) *Scheduler {
job := s.getCurrentJob()

Expand Down

0 comments on commit b94bd7e

Please sign in to comment.