Skip to content

Commit

Permalink
don't pass requests in error forward
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott committed Feb 28, 2024
1 parent 752ad3d commit 0589996
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/frontend/pipeline/async_sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func NewAsyncSharderFunc(concurrentReqs, totalReqs int, reqFn func(i int) *http.
continue
}

if err := req.Context().Err(); err != nil {
asyncResp.SendError(err)
continue
}

wg.Add(1)
go func(r *http.Request) {
defer wg.Done()
Expand Down Expand Up @@ -68,8 +73,11 @@ func NewAsyncSharderChan(concurrentReqs int, reqs <-chan *http.Request, resps Re
wg.Add(1)
go func() {
defer wg.Done()

for req := range reqs {
if err := req.Context().Err(); err != nil {
asyncResp.SendError(err)
continue
}

resp, err := next.RoundTrip(req)
if err != nil {
Expand Down

0 comments on commit 0589996

Please sign in to comment.