kit/cron
Alessandro (Ale) Segala 73be7928f6
Updates: (#36)
1. Removed `github.com/pkg/errors` and replaced with the standard library (linter now rejects the old package)
2. Cron test: fixed race conditions and linting
3. Renamed `logger/default.go` to `logger/nop_logger.go` to match the name of the struct inside

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2023-01-05 12:12:21 -08:00
..
.gitignore add cron fork (#31) 2022-12-01 12:22:46 -08:00
.travis.yml add cron fork (#31) 2022-12-01 12:22:46 -08:00
LICENSE add cron fork (#31) 2022-12-01 12:22:46 -08:00
README.md add cron fork (#31) 2022-12-01 12:22:46 -08:00
chain.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
chain_test.go Fix failing test for cron on Windows (#33) 2022-12-07 11:09:50 -08:00
constantdelay.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
constantdelay_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
cron.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
cron_test.go Updates: (#36) 2023-01-05 12:12:21 -08:00
doc.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
logger.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
option.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
option_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
parser.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
parser_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
spec.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
spec_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00

README.md

Cron

This package is a fork of github.com/robfig/cron/v3@v3.0.0 which adds support for mocking the time using github.com/benbjohnson/clock

See LICENSE for the license of the original package.

Using Cron with Mock Clock

import "github.com/benbjohnson/clock"

clk := clock.NewMock()
c := cron.New(cron.WithClock(clk))
c.AddFunc("@every 1h", func() {
 fmt.Println("Every hour")
})
c.Start()
clk.Add(1 * time.Hour)