Skip to content

Added successful case for context pool, returns before timeout#94

Merged
camdencheek merged 3 commits into
sourcegraph:mainfrom
zhongdai:add-success-case-context-pool
Feb 27, 2023
Merged

Added successful case for context pool, returns before timeout#94
camdencheek merged 3 commits into
sourcegraph:mainfrom
zhongdai:add-success-case-context-pool

Conversation

@zhongdai

Copy link
Copy Markdown
Contributor

I think we need an example of, if the tasks return before the context cancelled due to timeout, it should success

@zhongdai zhongdai force-pushed the add-success-case-context-pool branch from 26636b3 to f9863b0 Compare February 21, 2023 05:19

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great, thanks!

@codecov-commenter

codecov-commenter commented Feb 21, 2023

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.30%. Comparing base (7b8c8f2) to head (afc22ed).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #94   +/-   ##
=======================================
  Coverage   99.30%   99.30%           
=======================================
  Files          12       12           
  Lines         429      429           
=======================================
  Hits          426      426           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhongdai zhongdai force-pushed the add-success-case-context-pool branch from 3a649ad to 70d1ff6 Compare February 26, 2023 09:17
Comment thread pool/context_pool_test.go
}
})
require.NoError(t, p.Wait())
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey! I was just going to merge this (sorry for the delay), but noticed that this test case is inherently racy. Basically, we can't know for sure that the goroutine will be scheduled before the context times out, so time.After() may trigger after ctx.Done().

I've pushed a commit that uses a context that does not time out instead.

@camdencheek camdencheek merged commit ba7ce51 into sourcegraph:main Feb 27, 2023
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.

3 participants