Skip to content

Commit

Permalink
Spotify: Properly reset timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
univrsal committed Jan 10, 2023
1 parent 1efbe24 commit 61b4d7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/query/spotify_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,12 @@ long execute_command(const char* auth_token, const char* url, std::string& respo
static int timeout_multiplier = 1;

if (timeout > 0) {
if (util::epoch() - timeout_start >= timeout)
if (util::epoch() - timeout_start >= timeout) {
binfo("cURL request timeout over.");
else
timeout = 0;
} else {
return 0; // Waiting for timeout to be over
}
}

long http_code = -1;
Expand Down Expand Up @@ -518,6 +520,7 @@ long execute_command(const char* auth_token, const char* url, std::string& respo
} else {
timeout_multiplier = 1; // Reset on successful requests
timeout_start = 0;
timeout = 0;
}
} else {
timeout_start = util::epoch();
Expand Down

0 comments on commit 61b4d7b

Please sign in to comment.