Skip to content

Commit 28229d0

Browse files
fix: bug causing intermittent timeouts when loading a service page
1 parent fed1cb8 commit 28229d0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/resources/views/charts.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,16 @@ func chunk(items []collector.SeriesItem, perBucket, buckets int) [][]collector.S
161161

162162
// Pull the last item out so it doesn't leak goroutines every graph load
163163
run = false
164-
<-feed
164+
// If there is noting to pull out, then this will block, so run it in its
165+
// own goroutine with a timeout
166+
go func() {
167+
select {
168+
case <-time.After(time.Second):
169+
return
170+
case <-feed:
171+
return
172+
}
173+
}()
165174

166175
return out
167176
}

0 commit comments

Comments
 (0)