Lock main client from inside the session client when session requests are made (#71)

* Lock outer client from the main client from the session client when used

* Add race to test
This commit is contained in:
Nikola Jokic
2026-02-16 12:58:50 +01:00
committed by GitHub
parent efa922e8dd
commit ebedf0bbbf
3 changed files with 6 additions and 2 deletions
+3
View File
@@ -235,6 +235,9 @@ func (c *MessageSessionClient) Session() RunnerScaleSetSession {
}
func (c *MessageSessionClient) doSessionRequest(ctx context.Context, method, path string, requestData io.Reader, expectedResponseStatusCode int, responseUnmarshalTarget any) error {
c.innerClient.mu.Lock()
defer c.innerClient.mu.Unlock()
req, err := c.innerClient.newActionsServiceRequest(ctx, method, path, requestData)
if err != nil {
return fmt.Errorf("failed to create new actions service request: %w", err)