force executor to use attached logger instead of "log" package (#613)
This commit is contained in:
committed by
GitHub
parent
7e5ddc86bc
commit
3e2df30371
+4
-5
@@ -2,7 +2,6 @@ package gocron
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -291,7 +290,7 @@ func (e *executor) limitModeRunner(name string, in chan uuid.UUID, wg *waitGroup
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case id := <-in:
|
case id := <-in:
|
||||||
log.Println("limitModeRunner got job", id)
|
e.logger.Info("limitModeRunner got job", id)
|
||||||
select {
|
select {
|
||||||
case <-e.ctx.Done():
|
case <-e.ctx.Done():
|
||||||
e.logger.Debug("limitModeRunner shutting down", "name", name)
|
e.logger.Debug("limitModeRunner shutting down", "name", name)
|
||||||
@@ -303,11 +302,11 @@ func (e *executor) limitModeRunner(name string, in chan uuid.UUID, wg *waitGroup
|
|||||||
ctx, cancel := context.WithCancel(e.ctx)
|
ctx, cancel := context.WithCancel(e.ctx)
|
||||||
j := requestJobCtx(ctx, id, e.jobOutRequest)
|
j := requestJobCtx(ctx, id, e.jobOutRequest)
|
||||||
if j != nil {
|
if j != nil {
|
||||||
log.Println("limitModeRunner running job", id)
|
e.logger.Info("limitModeRunner running job", id)
|
||||||
e.runJob(*j)
|
e.runJob(*j)
|
||||||
}
|
}
|
||||||
cancel()
|
cancel()
|
||||||
log.Println("limitModeRunner finished job", id)
|
e.logger.Info("limitModeRunner finished job", id)
|
||||||
|
|
||||||
// remove the limiter block to allow another job to be scheduled
|
// remove the limiter block to allow another job to be scheduled
|
||||||
if limitMode == LimitModeReschedule {
|
if limitMode == LimitModeReschedule {
|
||||||
@@ -316,7 +315,7 @@ func (e *executor) limitModeRunner(name string, in chan uuid.UUID, wg *waitGroup
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("limitModeRunner job done", id)
|
e.logger.Info("limitModeRunner job done", id)
|
||||||
case <-e.ctx.Done():
|
case <-e.ctx.Done():
|
||||||
e.logger.Debug("limitModeRunner shutting down", "name", name)
|
e.logger.Debug("limitModeRunner shutting down", "name", name)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
|||||||
Reference in New Issue
Block a user