update at 2019-12-13 18:35:05 by ehlxr

master
ehlxr 2019-12-13 18:35:05 +08:00
parent 113d3a14e7
commit 2574de9a2f
1 changed files with 5 additions and 2 deletions

View File

@ -70,15 +70,17 @@ func tailFile() {
pkg.Opts.KeyWordIgnoreCase)
var buffer bytes.Buffer
var times int
go func() {
ticker := time.NewTicker(1 * time.Minute)
for {
<-ticker.C
log.Info("will send msg to dingtalk...")
if buffer.Len() > 0 {
if buffer.Len() > 0 && times > 2 {
sendMsg(buffer.String())
buffer.Reset()
}
times = 0
}
}()
@ -100,6 +102,7 @@ func tailFile() {
buffer.WriteString(line.Text)
buffer.WriteByte('\n')
times++
break
}