- Notifications
You must be signed in to change notification settings - Fork1k
chore(scaletest): add barrier synchronization primitive#19903
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ethanndickson commentedSep 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
if b.count.Add(-1) == 0 { | ||
close(b.done) | ||
} | ||
<-b.done |
ethanndicksonSep 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I contemplated having API consumers pass a ctx intoWait
, and then selecting on that to support individualWait
timeouts.
I opted against this on the basis that:
- I already needed to add the
Cancel
function, to handle user creation failure. - Other goroutines can just call that
Cancel
function in a defer, such as when their own timeouts fire.
The outcome being that this line won't block forever if the API is used properly.
297b92f
toc906248
Comparec906248
to9dcea42
CompareIsn't this just a Like:
is
And
is
I realize it's sometimes 2 calls instead of one, but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think we actually need this. c.f. above comment
case <-done: | ||
return | ||
case <-ctx.Done(): | ||
t.Fatal("barrier should have released after cancel") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
we havetestutil.RequireReceive()
for this since it comes up all the time.
9dcea42
to042db24
Compare
Uh oh!
There was an error while loading.Please reload this page.
Relates tocoder/internal#889.
To fairly compare the latency of Coder Connect workspace updates, we require that all clients be listening for workspace updates before we begin creating workspaces, and thus workspace updates.
To support this, this PR adds a barrier synchronization primitive. Only once
Wait
orCancel
has been calledsize
times will a goroutine callingWait
be unblocked.The
Cancel
function exists to handle the case where an instance of a Coder Connect runner exits early, if user creation fails. This single failure should not cause all the other goroutines to block indefinitely.