Skip to content

Commit

Permalink
pingServer: handle context cancellation
Browse files Browse the repository at this point in the history
Signed-off-by: oliverpool <[email protected]>
  • Loading branch information
oliverpool committed Dec 16, 2024
1 parent d46d7d7 commit c3fdd5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion connect_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2914,7 +2914,11 @@ func (p pingServer) CountUp(
if err := stream.Send(&pingv1.CountUpResponse{Number: i}); err != nil {
return err
}
time.Sleep(p.delayCountUp)
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(p.delayCountUp):
}
}
return nil
}
Expand Down

0 comments on commit c3fdd5a

Please sign in to comment.