Skip to content

Dead simple scheduler for modern scalable systems

License

Notifications You must be signed in to change notification settings

utkonos-dev/kronk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kronk GoDoc

kronk is dead simple scheduler for modern scalable systems.

It allows you to manage background tasks in a distributed architecture.

Already supports Redis as distributed lock manager.

So, now you can add jobs and be sure that they will be completed on only one instance.

Get started

1. Install and import package

go get -u github.com/utkonos-dev/kronk

2. Create Kronk

import (
    "github.com/utkonos-dev/kronk"
    redisAdapter "github.com/utkonos-dev/kronk/dlm/redis"
    "github.com/utkonos-dev/kronk/scheduler/cron"
)
k := kronk.New(
    redisAdapter.NewLocker(redisConn),
    cron.NewScheduler(),
    logger,
    kronk.Config{
        DefaultLockExp:     time.Second,
    },
)

3. Start scheduler

k.Start()

4. Add job

AddJob can be safely called on all instances, but the job will be performed only by one.

job := func() {
    fmt.Println("That'll work")
}

err := k.AddRegularJob("kronksays", "* * * * *", job)
if err != nil {
    // ...
}

PR accepted!

Releases

No releases published

Packages

No packages published

Languages