优化 代码

master
dengsgo 2020-10-17 10:24:37 +08:00
parent 605914d1e1
commit 9e651d3023
1 changed files with 8 additions and 7 deletions

View File

@ -30,14 +30,15 @@ func newTaskMan(delay int, callUrl string) *TaskMan {
go func() { go func() {
for { for {
<-t.waitChan <-t.waitChan
if len(t.waitQueue) > 0 { if len(t.waitQueue) < 1 {
cf := t.waitQueue[len(t.waitQueue)-1] return
if len(t.waitQueue) > 1 {
logInfo("redundant tasks dropped:", len(t.waitQueue)-1)
}
t.waitQueue = []*changedFile{}
go t.preRun(cf)
} }
cf := t.waitQueue[len(t.waitQueue)-1]
if len(t.waitQueue) > 1 {
logInfo("redundant tasks dropped:", len(t.waitQueue)-1)
}
t.waitQueue = []*changedFile{}
go t.preRun(cf)
} }
}() }()
} }