Skip to content

Infinite retry loop when receiving status code 204 #312

Closed
@Nielssg

Description

@Nielssg

Describe the bug
Recently in #305 a method has been added to return null when the Spotify API returns a 204 status. I found out that the library keeps retrying when it has found a 204 status code, instead of plainly returning null.

In the execute() method in the Endpoints.kt file, at line 134, we see that the API delegates the response handling (handleResponse), but also defaults to executing the method again when the result of that response handling is null. In the recent issue, a check has been added to the handleResponse() method which will return null if the status code is 204. This, however, triggers a retry due to the handleResponse(bla bla ..) ?: execute(bla bla ..).

To Reproduce
Steps to reproduce the behavior:

  1. Make sure to not use Spotify for a while, the 204 will occur if Spotify detects that you are not using it for a period of time
  2. Use the getCurrentContext method (spotifyClientAPI?.player?.getCurrentContext() to get the current playback state
  3. Setting breakpoints in the execute method of Endpoints.kt, you'll notice the retries

Expected behavior
Execute method should just return null instead of continously retry

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge

Smartphone (please complete the following information):

  • Device: S22+
  • OS: Android 12

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions