@@ -31,6 +31,9 @@ type executor struct {
31
31
// used to request jobs from the scheduler
32
32
jobOutRequest chan jobOutRequest
33
33
34
+ // sends out job needs to update the next runs
35
+ jobUpdateNextRuns chan uuid.UUID
36
+
34
37
// used by the executor to receive a stop signal from the scheduler
35
38
stopCh chan struct {}
36
39
// the timeout value when stopping
@@ -247,6 +250,14 @@ func (e *executor) sendOutForRescheduling(jIn *jobIn) {
247
250
jIn .shouldSendOut = false
248
251
}
249
252
253
+ func (e * executor ) sendOutForNextRunUpdate (jIn * jobIn ) {
254
+ select {
255
+ case e .jobUpdateNextRuns <- jIn .id :
256
+ case <- e .ctx .Done ():
257
+ return
258
+ }
259
+ }
260
+
250
261
func (e * executor ) limitModeRunner (name string , in chan jobIn , wg * waitGroupWithMutex , limitMode LimitMode , rescheduleLimiter chan struct {}) {
251
262
e .logger .Debug ("gocron: limitModeRunner starting" , "name" , name )
252
263
for {
@@ -376,6 +387,7 @@ func (e *executor) runJob(j internalJob, jIn jobIn) {
376
387
_ = callJobFuncWithParams (j .afterLockError , j .id , j .name , err )
377
388
e .sendOutForRescheduling (& jIn )
378
389
e .incrementJobCounter (j , Skip )
390
+ e .sendOutForNextRunUpdate (& jIn )
379
391
return
380
392
}
381
393
defer func () { _ = lock .Unlock (j .ctx ) }()
@@ -385,6 +397,7 @@ func (e *executor) runJob(j internalJob, jIn jobIn) {
385
397
_ = callJobFuncWithParams (j .afterLockError , j .id , j .name , err )
386
398
e .sendOutForRescheduling (& jIn )
387
399
e .incrementJobCounter (j , Skip )
400
+ e .sendOutForNextRunUpdate (& jIn )
388
401
return
389
402
}
390
403
defer func () { _ = lock .Unlock (j .ctx ) }()
0 commit comments