https://github.com/firminochangani/recurrent
A Go package to run tasks recurrently.
https://github.com/firminochangani/recurrent
go golang golang-library golang-package recurring-jobs recurring-tasks
Last synced: about 1 year ago
JSON representation
A Go package to run tasks recurrently.
- Host: GitHub
- URL: https://github.com/firminochangani/recurrent
- Owner: firminochangani
- License: mit
- Created: 2024-01-20T21:50:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T02:16:13.000Z (over 2 years ago)
- Last Synced: 2025-05-18T11:09:40.249Z (about 1 year ago)
- Topics: go, golang, golang-library, golang-package, recurring-jobs, recurring-tasks
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# recurrent
[](https://github.com/flowck/schedule/actions/workflows/main.yml)
A Go package to run tasks recurrently. - Inspired by the Python lib [schedule](https://github.com/dbader/schedule)
- [x] Parallel execution of jobs
- [x] Cancellation of running jobs via context
## Usage
```go
package main
import (
"context"
"fmt"
"time"
"github.com/flowck/recurrent/recurrent"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
s := recurrent.New()
s.Every(time.Second * 1).Do(func(ctx context.Context) {
fmt.Println("--->", time.Now())
})
s.Every(time.Second * 2).Do(func(ctx context.Context) {
fmt.Println("--->", time.Now())
})
s.Run(ctx)
}
```