add logs
parent
739e832222
commit
3f7c13a6be
|
|
@ -27,12 +27,19 @@ type Scheduler struct {
|
|||
type semaphored struct {
|
||||
job cron.Job
|
||||
ch chan struct{}
|
||||
l logger.Logger
|
||||
}
|
||||
|
||||
func (s semaphored) Run() {
|
||||
s.l.Info("scheduler.semaphored.Run() | acquiring...")
|
||||
s.ch <- struct{}{}
|
||||
s.l.Info("scheduler.semaphored.Run() | acquired")
|
||||
|
||||
s.job.Run()
|
||||
|
||||
s.l.Info("scheduler.semaphored.Run() | releasing...")
|
||||
<-s.ch
|
||||
s.l.Info("scheduler.semaphored.Run() | released")
|
||||
}
|
||||
|
||||
func New() *Scheduler {
|
||||
|
|
@ -46,6 +53,7 @@ func New() *Scheduler {
|
|||
cron.Recover(l),
|
||||
func(j cron.Job) cron.Job {
|
||||
return semaphored{
|
||||
l: l,
|
||||
job: j,
|
||||
ch: semaphore,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue