You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
622 B
24 lines
622 B
1 year ago
|
package gocron
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"errors"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
ErrFailedToConnectToRedis = errors.New("gocron: failed to connect to redis")
|
||
|
ErrFailedToObtainLock = errors.New("gocron: failed to obtain lock")
|
||
|
ErrFailedToReleaseLock = errors.New("gocron: failed to release lock")
|
||
|
)
|
||
|
|
||
|
// Locker represents the required interface to lock jobs when running multiple schedulers.
|
||
|
type Locker interface {
|
||
|
// Lock if an error is returned by lock, the job will not be scheduled.
|
||
|
Lock(ctx context.Context, key string) (Lock, error)
|
||
|
}
|
||
|
|
||
|
// Lock represents an obtained lock
|
||
|
type Lock interface {
|
||
|
Unlock(ctx context.Context) error
|
||
|
}
|