Achievements: Use a 60 second timeout for server calls

This commit is contained in:
Stenzek 2023-11-06 19:59:16 +10:00
parent 0fe6e9170b
commit b459a42fb7
No known key found for this signature in database

View file

@ -77,6 +77,12 @@ static constexpr float LEADERBOARD_FAILED_NOTIFICATION_TIME = 3.0f;
static constexpr float INDICATOR_FADE_IN_TIME = 0.1f;
static constexpr float INDICATOR_FADE_OUT_TIME = 0.5f;
// Some API calls are really slow. Set a longer timeout.
static constexpr float SERVER_CALL_TIMEOUT = 60.0f;
// Chrome uses 10 server calls per domain, seems reasonable.
static constexpr u32 MAX_CONCURRENT_SERVER_CALLS = 10;
namespace {
struct LoginWithPasswordParameters
{
@ -438,6 +444,9 @@ bool Achievements::CreateClient(rc_client_t** client, std::unique_ptr<HTTPDownlo
return false;
}
(*http)->SetTimeout(SERVER_CALL_TIMEOUT);
(*http)->SetMaxActiveRequests(MAX_CONCURRENT_SERVER_CALLS);
rc_client_t* new_client = rc_client_create(ClientReadMemory, ClientServerCall);
if (!new_client)
{