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