derp: remove stats goroutine, use a timer
Without changing behaviour, don't create a goroutine per connection that sits and sleeps, but rather use a timer that wakes up and gathers statistics on a regular basis. Fixes #12127 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Ibc486447e403070bdc3c2cd8ae340e7d02854f21
This commit is contained in:
+2
-1
@@ -776,7 +776,6 @@ func (c *sclient) run(ctx context.Context) error {
|
||||
var grp errgroup.Group
|
||||
sendCtx, cancelSender := context.WithCancel(ctx)
|
||||
grp.Go(func() error { return c.sendLoop(sendCtx) })
|
||||
grp.Go(func() error { return c.statsLoop(sendCtx) })
|
||||
defer func() {
|
||||
cancelSender()
|
||||
if err := grp.Wait(); err != nil && !c.s.isClosed() {
|
||||
@@ -788,6 +787,8 @@ func (c *sclient) run(ctx context.Context) error {
|
||||
}
|
||||
}()
|
||||
|
||||
c.startStatsLoop(sendCtx)
|
||||
|
||||
for {
|
||||
ft, fl, err := readFrameHeader(c.br)
|
||||
c.debugLogf("read frame type %d len %d err %v", ft, fl, err)
|
||||
|
||||
Reference in New Issue
Block a user