Commit Graph

59 Commits

Author SHA1 Message Date
John Roesler 9cc3be7cff
fix: calling start multiple times should no-op (#901)
* fix: calling start multiple times should no-op

* give test more time after start

* add a mutex
2025-11-26 13:38:55 -06:00
John Roesler 5b2fe32639
fix: WithStartDateTimePast now correctly calculates from past time (#897) 2025-11-24 10:08:17 -06:00
OsipovMax 46660bbfb3
fix: limit validation for WithLimitedRuns (#893)
Co-authored-by: Maksim Osipov <osipov.maksim39@rwb.ru>
Co-authored-by: John Roesler <johnrroesler@gmail.com>
2025-11-05 13:19:14 -06:00
John Roesler 6a30d6d8b9
feat: add WithStartDateTimePast WithStartAt option (#882) 2025-10-09 21:45:13 -05:00
John Roesler 536410f98a
fix: multiple calls to shutdown should be no-op (#880)
* fix: multiple calls to shutdown should be no-op

* timing was off - need to cancel context before returning early
2025-10-09 11:19:35 -05:00
John Roesler 70468cccd8
fix: handle negative time.durations with error (#878) 2025-10-08 15:50:07 -05:00
apocelipes b383ca99c5
Use `errors.New` for non-formatted strings (#870) 2025-09-02 08:48:40 -05:00
John Roesler cc3a1dbf46
Bump testify (#868)
* Bump github.com/stretchr/testify from 1.10.0 to 1.11.0

* fix tests
2025-08-27 15:10:53 -05:00
dependabot[bot] eb4dfe6700
go 1.23 & golangci-lint v2 (#843)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: John Roesler <johnrroesler@gmail.com>
2025-04-29 10:43:10 -05:00
John Roesler 08b53d788a
re-enable goleak detection in ci (#832)
* re-enable goleak detection in ci

* fix version string

* re-add go 1.23
2025-02-17 15:18:43 -06:00
Oleksandr Redko 34fc56e077
fix err assertion in TestScheduler_RemoveJob (#830) 2025-02-14 09:12:39 -06:00
Guang Jiong Lou a757eff276
fix scheduler restart (#825) 2025-02-07 10:28:32 -06:00
John Roesler d736ca28f5
go to 1.21, upgrade deps (#822)
* go to 1.21, upgrade deps

* test without 1.23
2025-01-29 10:37:12 -06:00
John Roesler ce204f9d74
check context not nil, and update test and docs (#820) 2025-01-23 13:30:12 -06:00
Guang Jiong Lou 50966c7365
cancel running jobs if possible when run Scheduler.StopJobs() (#819)
* cancel running job when run Scheduler.StopJobs()

Signed-off-by: lou <alex1988@outlook.com>

* trivial

Signed-off-by: lou <alex1988@outlook.com>

* Update scheduler_test.go

---------

Signed-off-by: lou <alex1988@outlook.com>
Co-authored-by: John Roesler <johnrroesler@gmail.com>
2025-01-23 12:27:28 -06:00
Hossein Shahsahebi f5a5a2d0bc
feat: allow disabling global distributed locker per job (#811)
* chore: fix distributed locker tests

* feat: allow disabling global dist locker per job
2025-01-03 15:12:34 -06:00
John Roesler 46bcd8e030
weekly and monthly jobs should not allow zero interval (#792) 2024-10-31 11:42:35 -05:00
John Roesler 4baf341092
dailyjob should not allow interval zero (#791) 2024-10-31 10:52:35 -05:00
Rodrigo Broggi 838bd518a0
Issue 778 (#779) 2024-09-19 08:18:50 -05:00
John Roesler 3ccd68d676
handle crontab and return error with invalid day in a month (#766) 2024-08-09 10:11:54 -05:00
Higan 3b2dcd869b
issue-654: allow setting a stopTime for job. (#760) 2024-07-19 13:10:28 -05:00
John Roesler 256265f9a2
internal refactoring of JobOption constructor, clock moved to exec (#761) 2024-07-18 11:32:56 -05:00
apocelipes f37e274abb
issue-756: fix interface variadic parameters verifying (#757) 2024-07-17 06:56:17 -05:00
Higan 2c08083603
issue-677: support task creation with variadic args (#755) 2024-07-11 21:24:08 -05:00
Derrick Hammer 63a6458a5b
feat: add WithIdentifier (#753) (#754) 2024-07-10 09:51:37 -05:00
Rodrigo Broggi 212db8e476
issue-740: ascending time function (#744)
* issue-740: ascending time function

* issue-740: update documentation

* issue-740: un-export ascending function

* issue-740: sentence correction
2024-06-23 13:14:35 -05:00
Rodrigo Broggi 64d6e48dae
issue-740: expand oneTimeJob to support multiple times (#741) 2024-06-21 16:51:42 -05:00
Rodrigo Broggi 7c391d4326
issue-742: bug in `NextRun` (#743)
* issue-742: bug in `NextRun`

* issue-742: bug in `NextRun` correction
2024-06-21 09:17:34 -05:00
Manuel Doncel Martos 894970124c
after lock error listener (#734)
* after job listener

* fixing lint issues

---------

Co-authored-by: lv90no <manuel.doncel.martos@ing.com>
2024-06-19 06:33:50 -05:00
John Roesler 525b361a3f
adding Job.NextRuns to provide n next run times (#729)
* adding Job.NextRuns to provide n next run times

* skip test in ci

* skip test in ci
2024-05-06 14:07:44 -05:00
John Roesler 32c0374320
fix-up flakey test 2024-05-04 18:32:34 -05:00
John Roesler ce96452c3e
Circleci project setup (#727)
* skip test goroutine leak detection in github actions

* CircleCI Commit

* skip leak detection in circle ci as well
2024-05-02 14:50:11 -05:00
John Roesler e46cdc9d11
fix memory leak with singleton mode where job is sending duplicate reschedule requests (#723)
* fix memory leak with singleton mode where job is sending duplicate reschedule requests

* add a comment

* fix memory leak for limitmode as well

* tests are happy locally - some timing issues in actions
2024-05-02 11:35:57 -05:00
Giridharan Ramasamy 5f14dac979
Added JobsWaitingInQueue in Scheduler (#721)
* Added JobsWaitingInQueue in Scheduler

* Fixed tests
2024-04-30 14:32:20 -05:00
Giridharan Ramasamy 3faf525f98
Added Distributed Locker to JobOptions (#711) 2024-04-22 13:52:27 -05:00
John Roesler 3b653b99e4
fix nextRun with singleton mode reporting incorrect time (#705)
* fix nextRun with singleton mode reporting incorrect time

* only remove past if >1, sort next scheduled

* update test, remove no longer needed lastScheduledRun
2024-04-05 20:56:22 -05:00
John Roesler dcd4edae17
fix case where OneTimeJob with concurrent limit and limited runs fails to run (#703) 2024-03-26 16:29:25 -05:00
John Roesler 9ae7545c27
add another out channel so we can properly report lastRun (#700)
* add another out channel so we can properly report lastRun

* don't block on channel send

* add tests
2024-03-26 09:55:21 -05:00
墨语 5b1cf9c619
return an error if duration is zero (#701) 2024-03-25 15:58:47 -05:00
Drew Gonzales b0bd435279
Allow more time for requestJobCtx (#699)
* allow more time for jobout request

* gofmt
2024-03-23 13:54:40 -05:00
John Roesler ebec5e9f91
elector & locker were failing to send out when not leader (#688)
* elector & locker were failing to send out when not leader

* update test to confirm non-active elector/locker are checked

* clean up data race

* try to make test more reliable
2024-03-12 08:37:11 -05:00
John Roesler 27f2cbaa41
fix cases where default on send out is resulting in job not going out (#686) 2024-03-05 10:55:42 -06:00
John Roesler b1ffc665fb
fix RunNow() when calling from a job returned by Jobs() (#668) 2024-02-02 09:46:08 -06:00
John Roesler 5c69001e27
Add job monitor interface to allow for collecting job metrics (#659)
* Add metrics each run of job

* Fix lint

* Fix test lint

* Fix backwards job status

* Add tags

* Comment example

* Rename it

* Fix some names

* Fix readme

* update readme, examples, naming

* fix unrelated test that was leaking scheduler

* remove overzealous leak detection

* rename interface methods

---------

Co-authored-by: gorodet-sky <gorodetsky.dev@gmail.com>
2024-01-17 15:39:11 -06:00
John Roesler 800821c923
wait for new job to be fully created before returning (#658) 2024-01-17 11:48:25 -06:00
John Roesler ae366d91ea
make the order of the returned jobs slice deterministic (#652) 2024-01-02 10:47:01 -06:00
John Roesler 6e15f16d77
add new features, OneTimeJob and Job.RunNow() (#646) 2023-12-18 21:13:37 -06:00
John Roesler 80a4f43686
check function param length and type (#638) 2023-12-14 13:52:32 -06:00
John Roesler aa4400d224
Update docs, tests, and release prep (#629) 2023-12-11 10:39:59 -06:00
John Roesler 5814fbcb6f
allow max concurrent runs and singleton mode together (#625) 2023-11-28 06:48:22 -06:00