Skip to content

Commit

Permalink
Fix race condition in TestPipelineClientIssue832
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdubbelboer committed Jun 18, 2021
1 parent 9f2c636 commit 410bde6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ func TestPipelineClientIssue832(t *testing.T) {
ln := fasthttputil.NewInmemoryListener()

req := AcquireRequest()
defer ReleaseRequest(req)
// Don't defer ReleaseRequest as we use it in a goroutine that might not be done at the end.

req.SetHost("example.com")

res := AcquireResponse()
defer ReleaseResponse(res)
// Don't defer ReleaseResponse as we use it in a goroutine that might not be done at the end.

client := PipelineClient{
Dial: func(addr string) (net.Conn, error) {
Expand Down
2 changes: 1 addition & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ func TestServerContinueHandler(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error from serveConn: %s", err)
}
case <-time.After(100 * time.Millisecond):
case <-time.After(200 * time.Millisecond):
t.Fatal("timeout")
}

Expand Down

0 comments on commit 410bde6

Please sign in to comment.