Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix context canceled error via manual cancelling #9

Merged
merged 10 commits into from
Jun 8, 2021
Merged

Conversation

cristaloleg
Copy link
Member

@cristaloleg cristaloleg commented Jun 8, 2021

Signed-off-by: Oleg Kovalov [email protected]

Idea is pretty simple - close what was failed manually. No fails for go test -v -count=100 -run=TestHTTP2 (haven't added HTTP2 test 'cause would like to omit not so needed dependencies).

import "golang.org/x/net/http2"

func TestHTTP2(t *testing.T) {
	req, err := http.NewRequest("GET", "https://www.google.com", http.NoBody)
	if err != nil {
		t.Fatal(err)
	}

	const upto = 2
	client := &http.Client{
		Transport: NewRoundTripper(10*time.Millisecond, upto, &http2.Transport{}),
	}

	resp, err := client.Do(req)
	if err != nil {
		t.Fatal(err)
	}

	time.Sleep(50 * time.Millisecond)

	_, err = io.ReadAll(resp.Body)
	if err != nil && err != io.EOF {
		t.Fatal(err)
	}
}

@cristaloleg cristaloleg mentioned this pull request Jun 8, 2021
Signed-off-by: Oleg Kovalov <[email protected]>
@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #9 (34c3acc) into main (980f5db) will increase coverage by 1.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
+ Coverage   85.88%   86.95%   +1.07%     
==========================================
  Files           1        1              
  Lines          85       92       +7     
==========================================
+ Hits           73       80       +7     
  Misses         11       11              
  Partials        1        1              
Impacted Files Coverage Δ
hedged.go 86.95% <100.00%> (+1.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 980f5db...34c3acc. Read the comment docs.

Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Signed-off-by: Oleg Kovalov <[email protected]>
Copy link
Contributor

@storozhukBM storozhukBM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cristaloleg cristaloleg merged commit 78f85d7 into main Jun 8, 2021
@cristaloleg cristaloleg deleted the fix-context branch June 8, 2021 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants