return body in handleUnexpectedClose

This commit is contained in:
filifa 2025-04-07 23:25:56 -04:00
parent ccf95a1a21
commit d622060355
1 changed files with 5 additions and 5 deletions

View File

@ -100,20 +100,20 @@ func newWebsocket(gamePk int32) (*gamedayWebsocket, <-chan error, error) {
return ws, ch, nil return ws, ch, nil
} }
func handleUnexpectedClose(body []byte, client *api.APIClient) (*gamedayWebsocket, error) { func handleUnexpectedClose(body []byte, client *api.APIClient) ([]byte, *gamedayWebsocket, error) {
ws, _, err := newWebsocket(gamePk) ws, _, err := newWebsocket(gamePk)
if err != nil { if err != nil {
return nil, err return body, nil, err
} }
req := client.GameAPI.LiveGameV1(context.Background(), gamePk) req := client.GameAPI.LiveGameV1(context.Background(), gamePk)
resp, err := req.Execute() resp, err := req.Execute()
if err != nil { if err != nil {
return ws, err return body, ws, err
} }
body, err = io.ReadAll(resp.Body) body, err = io.ReadAll(resp.Body)
return ws, err return body, ws, err
} }
func updateFeed(body []byte, ws *gamedayWebsocket, client *api.APIClient) ([]byte, error) { func updateFeed(body []byte, ws *gamedayWebsocket, client *api.APIClient) ([]byte, error) {
@ -122,7 +122,7 @@ func updateFeed(body []byte, ws *gamedayWebsocket, client *api.APIClient) ([]byt
if websocket.IsUnexpectedCloseError(err, GameFinalCode, GameUnavailableCode) { if websocket.IsUnexpectedCloseError(err, GameFinalCode, GameUnavailableCode) {
log.Println(err) log.Println(err)
newWs, err := handleUnexpectedClose(body, client) body, newWs, err := handleUnexpectedClose(body, client)
if err != nil { if err != nil {
return body, err return body, err
} }