Skip to content

Commit

Permalink
Read up to 50 net namespace a second, and delete the results once used.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwilkie committed Jan 26, 2016
1 parent f907325 commit 5c29c6f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions probe/endpoint/procspy/backgound_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

const (
timeout = 60 // keep contents for 60 seconds
size = 10 * 1024 * 1024 // keep upto 10MB worth
ratelimit = 100 * time.Millisecond // read 10 files per second
timeout = 60 // keep contents for 60 seconds
size = 10 * 1024 * 1024 // keep upto 10MB worth
ratelimit = 20 * time.Millisecond // read 50 files per second
)

type backgroundReader struct {
Expand Down Expand Up @@ -89,6 +89,8 @@ func (br *backgroundReader) readFile(filename string, buf *bytes.Buffer) (int64,
if err != nil {
return 0, nil
}
// race!
br.cache.Del([]byte(filename))
n, err := buf.Write(v)
return int64(n), err
}

0 comments on commit 5c29c6f

Please sign in to comment.