mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:07:07 +02:00
Don't reload on error
This commit is contained in:
parent
9a9c703a78
commit
8f74935e96
1 changed files with 4 additions and 3 deletions
|
@ -380,13 +380,14 @@ void Resource::handleReplyFinished() {
|
||||||
case ResourceRequest::Result::Timeout:
|
case ResourceRequest::Result::Timeout:
|
||||||
qDebug() << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal;
|
qDebug() << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal;
|
||||||
// Fall through to other cases
|
// Fall through to other cases
|
||||||
case ResourceRequest::Result::ServerUnavailable:
|
case ResourceRequest::Result::ServerUnavailable: {
|
||||||
case ResourceRequest::Result::Error: {
|
|
||||||
// retry with increasing delays
|
// retry with increasing delays
|
||||||
const int MAX_ATTEMPTS = 8;
|
const int MAX_ATTEMPTS = 8;
|
||||||
const int BASE_DELAY_MS = 1000;
|
const int BASE_DELAY_MS = 1000;
|
||||||
if (++_attempts < MAX_ATTEMPTS) {
|
if (++_attempts < MAX_ATTEMPTS) {
|
||||||
QTimer::singleShot(BASE_DELAY_MS * (int)pow(2.0, _attempts), this, &Resource::attemptRequest);
|
auto waitTime = BASE_DELAY_MS * (int)pow(2.0, _attempts);
|
||||||
|
qDebug() << "Retrying to load the asset in " << waitTime;
|
||||||
|
QTimer::singleShot(waitTime, this, &Resource::attemptRequest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// fall through to final failure
|
// fall through to final failure
|
||||||
|
|
Loading…
Reference in a new issue