Skip to content

Commit

Permalink
修复一秒内重复执行
Browse files Browse the repository at this point in the history
  • Loading branch information
iwannay committed Aug 6, 2019
1 parent 763f685 commit e6974e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jiacrontabd/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ func (j *JobEntry) exec() {
}

if !j.once {

// 忽略一秒内重复执行的job
if j.detail.LastExecTime.Truncate(time.Second).Equal(time.Now().Truncate(time.Second)) {
log.Infof("ignore repeat job %s", j.detail.Name)
return
}

if !j.detail.NextExecTime.Truncate(time.Second).Equal(j.job.GetNextExecTime().Truncate(time.Second)) {
log.Errorf("%s(%d) JobEntry.exec time error(%s not equal %s)",
j.detail.Name, j.detail.ID, j.detail.NextExecTime, j.job.GetNextExecTime())
Expand Down

0 comments on commit e6974e8

Please sign in to comment.