Skip to content

Commit

Permalink
update godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkun Karaduman committed Dec 31, 2023
1 parent cfb36d6 commit 759a216
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions redcron.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func New(cfg Config) (c *RedCron) {
}

// Register registers a new cron job by the given parameters. It returns the underlying RedCron.
// If the underlying RedCron is stopped, registered cron jobs won't be triggered.
func (c *RedCron) Register(name string, repeatSec int, offsetSec int, f func(context.Context)) *RedCron {
if name == "" {
panic(errors.New("name must be non-empty"))
Expand All @@ -63,9 +64,7 @@ func (c *RedCron) Register(name string, repeatSec int, offsetSec int, f func(con
// When ctx has been done, all contexts of jobs are cancelled.
// If ctx is nil, all contexts of jobs are cancelled immediately.
func (c *RedCron) Stop(ctx context.Context) {
if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) {
//return
}
atomic.CompareAndSwapInt32(&c.stopped, 0, 1)

done := make(chan struct{})
go func() {
Expand Down

0 comments on commit 759a216

Please sign in to comment.