Fix parsing AcquireJob MessageQueueTokenExpiredError (#2837)

This commit is contained in:
Nikola Jokic
2023-08-25 20:35:01 +02:00
committed by GitHub
parent 215b245881
commit 52fc819339
2 changed files with 46 additions and 1 deletions
+12 -1
View File
@@ -634,7 +634,18 @@ func (c *Client) AcquireJobs(ctx context.Context, runnerScaleSetId int, messageQ
}
if resp.StatusCode != http.StatusOK {
return nil, ParseActionsErrorFromResponse(resp)
if resp.StatusCode != http.StatusUnauthorized {
return nil, ParseActionsErrorFromResponse(resp)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
body = trimByteOrderMark(body)
if err != nil {
return nil, err
}
return nil, &MessageQueueTokenExpiredError{msg: string(body)}
}
var acquiredJobs *Int64List