Skip to content

Commit 3575be8

Browse files
committed
fixup! chore: refactor agent stats streaming
1 parent aaef131 commit 3575be8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

agent/agent_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestAgent(t *testing.T) {
7373
var s *codersdk.AgentStats
7474
require.Eventuallyf(t, func() bool {
7575
var ok bool
76-
s, ok = (<-stats)
76+
s, ok = <-stats
7777
return ok && s.NumConns > 0 && s.RxBytes > 0 && s.TxBytes > 0
7878
}, testutil.WaitLong, testutil.IntervalFast,
7979
"never saw stats: %+v", s,
@@ -102,7 +102,7 @@ func TestAgent(t *testing.T) {
102102
var s *codersdk.AgentStats
103103
require.Eventuallyf(t, func() bool {
104104
var ok bool
105-
s, ok = (<-stats)
105+
s, ok = <-stats
106106
return ok && s.NumConns > 0 && s.RxBytes > 0 && s.TxBytes > 0
107107
}, testutil.WaitLong, testutil.IntervalFast,
108108
"never saw stats: %+v", s,

codersdk/workspaceagents.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,9 @@ func (c *Client) AgentReportStats(
626626
for r := retry.New(100*time.Millisecond, time.Minute); r.Wait(ctx); {
627627
resp, err := sendStats(ctx)
628628
if err != nil {
629-
log.Error(ctx, "report stats", slog.Error(err))
629+
if !xerrors.Is(err, context.Canceled) {
630+
log.Error(ctx, "report stats", slog.Error(err))
631+
}
630632
continue
631633
}
632634

0 commit comments

Comments
 (0)