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

This commit is contained in:
ehlxr 2019-12-13 18:35:05 +08:00
parent 113d3a14e7
commit 2574de9a2f

View File

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