Skip to content

Commit

Permalink
chore: increased the api request timeout (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nethius authored Dec 3, 2024
1 parent 4efaf20 commit 5dc16c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/core/controllers/apiController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ namespace
constexpr char authData[] = "auth_data";
}

const int requestTimeoutMsecs = 12 * 1000; // 12 secs

ErrorCode checkErrors(const QList<QSslError> &sslErrors, QNetworkReply *reply)
{
if (!sslErrors.empty()) {
Expand Down Expand Up @@ -177,7 +179,7 @@ void ApiController::fillServerConfig(const QString &protocol, const ApiControlle
QStringList ApiController::getProxyUrls()
{
QNetworkRequest request;
request.setTransferTimeout(7000);
request.setTransferTimeout(requestTimeoutMsecs);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

QEventLoop wait;
Expand Down Expand Up @@ -280,7 +282,7 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c

if (serverConfig.value(config_key::configVersion).toInt()) {
QNetworkRequest request;
request.setTransferTimeout(7000);
request.setTransferTimeout(requestTimeoutMsecs);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
request.setRawHeader("Authorization", "Api-Key " + serverConfig.value(configKey::accessToken).toString().toUtf8());
QString endpoint = serverConfig.value(configKey::apiEdnpoint).toString();
Expand Down Expand Up @@ -336,7 +338,7 @@ ErrorCode ApiController::getServicesList(QByteArray &responseBody)
#endif

QNetworkRequest request;
request.setTransferTimeout(7000);
request.setTransferTimeout(requestTimeoutMsecs);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

request.setUrl(QString("%1v1/services").arg(m_gatewayEndpoint));
Expand Down Expand Up @@ -390,7 +392,7 @@ ErrorCode ApiController::getConfigForService(const QString &installationUuid, co
#endif

QNetworkRequest request;
request.setTransferTimeout(7000);
request.setTransferTimeout(requestTimeoutMsecs);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

request.setUrl(QString("%1v1/config").arg(m_gatewayEndpoint));
Expand Down

0 comments on commit 5dc16c0

Please sign in to comment.