Skip to content

Commit

Permalink
add beta notes
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler committed May 5, 2023
1 parent 1e27df1 commit 1b5292c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ For more examples, take a look in our [go docs](https://pkg.go.dev/github.com/go

There are several options available to restrict how jobs run:

| Mode | Function | Behavior |
|---------------------|---------------------------|------------------------------------------------------------------------------------------------------|
| Default | | jobs are rescheduled at every interval |
| Job singleton | `SingletonMode()` | a long running job will not be rescheduled until the current run is completed |
| Scheduler limit | `SetMaxConcurrentJobs()` | set a collective maximum number of concurrent jobs running across the scheduler |
| Distributed locking | `WithDistributedLocker()` | prevents the same job from being run more than once when running multiple instances of the scheduler |
| Mode | Function | Behavior |
|----------------------------|---------------------------|------------------------------------------------------------------------------------------------------|
| Default | | jobs are rescheduled at every interval |
| Job singleton | `SingletonMode()` | a long running job will not be rescheduled until the current run is completed |
| Scheduler limit | `SetMaxConcurrentJobs()` | set a collective maximum number of concurrent jobs running across the scheduler |
| Distributed locking (BETA) | `WithDistributedLocker()` | prevents the same job from being run more than once when running multiple instances of the scheduler |

## Tags

Expand All @@ -117,8 +117,9 @@ s.RunByTag("tag")
## FAQ

- Q: I'm running multiple pods on a distributed environment. How can I make a job not run once per pod causing duplication?
- A: Use the scheduler option `WithDistributedLocker` and either use an implemented backend or implement your own
- and contribute it back in a PR (we hope)!
- We recommend using your own lock solution within the jobs themselves (you could use [Redis](https://redis.io/topics/distlock), for example)
- A2: Currently in BETA (please provide feedback): Use the scheduler option `WithDistributedLocker` and either use an implemented backend
or implement your own and contribute it back in a PR (we hope)!

- Q: I've removed my job from the scheduler, but how can I stop a long-running job that has already been triggered?
- A: We recommend using a means of canceling your job, e.g. a `context.WithCancel()`.
Expand Down
3 changes: 3 additions & 0 deletions scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,9 @@ func (s *Scheduler) StopBlockingChan() {
// WithDistributedLocker prevents the same job from being run more than once
// when multiple schedulers are trying to schedule the same job.
//
// NOTE - This is currently in BETA. Please provide any feedback on your usage
// and open bugs with any issues.
//
// One strategy to reduce splay in the job execution times when using
// intervals (e.g. 1s, 1m, 1h), on each scheduler instance, is to use
// StartAt with time.Now().Round(interval) to start the job at the
Expand Down

0 comments on commit 1b5292c

Please sign in to comment.