Merge pull request #103 from aristanetworks/upstream

tail: Minor code cleanup.
This commit is contained in:
Nino Kodabande 2017-02-06 18:33:46 -08:00 committed by GitHub
commit faf842bde7
1 changed files with 5 additions and 6 deletions

View File

@ -22,7 +22,7 @@ import (
) )
var ( var (
ErrStop = fmt.Errorf("tail should now stop") ErrStop = errors.New("tail should now stop")
) )
type Line struct { type Line struct {
@ -250,7 +250,7 @@ func (tail *Tail) tailFileSync() {
tail.openReader() tail.openReader()
var offset int64 = 0 var offset int64
var err error var err error
// Read line by line. // Read line by line.
@ -273,10 +273,9 @@ func (tail *Tail) tailFileSync() {
if cooloff { if cooloff {
// Wait a second before seeking till the end of // Wait a second before seeking till the end of
// file when rate limit is reached. // file when rate limit is reached.
msg := fmt.Sprintf( msg := ("Too much log activity; waiting a second " +
"Too much log activity; waiting a second " +
"before resuming tailing") "before resuming tailing")
tail.Lines <- &Line{msg, time.Now(), fmt.Errorf(msg)} tail.Lines <- &Line{msg, time.Now(), errors.New(msg)}
select { select {
case <-time.After(time.Second): case <-time.After(time.Second):
case <-tail.Dying(): case <-tail.Dying():