From 5c29c6f04196f2ea4abe667c27425acdc4501c52 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Mon, 25 Jan 2016 22:18:47 -0800 Subject: [PATCH] Read up to 50 net namespace a second, and delete the results once used. --- probe/endpoint/procspy/backgound_reader.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/probe/endpoint/procspy/backgound_reader.go b/probe/endpoint/procspy/backgound_reader.go index 8c12fb9135..7f3483e635 100644 --- a/probe/endpoint/procspy/backgound_reader.go +++ b/probe/endpoint/procspy/backgound_reader.go @@ -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 { @@ -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 }