mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add codersdk constructor that uses an independent transport (#22282)
This is useful at least in the case of scaletests but potentially in other places as well. I noticed that scaletest workspace creation hammers a single coderd replica. --------- Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
@@ -77,7 +77,14 @@ func (r *Runner) Run(ctx context.Context, id string, logs io.Writer) error {
|
||||
return xerrors.Errorf("create user: %w", err)
|
||||
}
|
||||
user = newUser.User
|
||||
client = codersdk.New(r.client.URL)
|
||||
// Duplicate the client with an independent transport to ensure each
|
||||
// workspace creation gets its own HTTP connection pool. This prevents
|
||||
// HTTP/2 connection multiplexing from causing all workspace GET requests
|
||||
// to route to a single backend pod during load testing.
|
||||
client, err = loadtestutil.DupClientCopyingHeaders(r.client, nil)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("duplicate client: %w", err)
|
||||
}
|
||||
client.SetSessionToken(newUser.SessionToken)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user