Fix high CPU usage on 5XX error codes
This commit is contained in:
parent
7df6529310
commit
7a2b996f18
@ -974,36 +974,15 @@ ChatPage::trySync()
|
|||||||
const auto err_code = mtx::errors::to_string(err->matrix_error.errcode);
|
const auto err_code = mtx::errors::to_string(err->matrix_error.errcode);
|
||||||
const int status_code = static_cast<int>(err->status_code);
|
const int status_code = static_cast<int>(err->status_code);
|
||||||
|
|
||||||
if (status_code <= 0 || status_code >= 600) {
|
if (http::is_logged_in() && err->matrix_error.errcode ==
|
||||||
if (!http::is_logged_in())
|
mtx::errors::ErrorCode::M_UNKNOWN_TOKEN) {
|
||||||
return;
|
emit dropToLoginPageCb(msg);
|
||||||
|
|
||||||
emit tryDelayedSyncCb();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nhlog::net()->error("sync error: {} {}", status_code, err_code);
|
nhlog::net()->error("sync error: {} {}", status_code, err_code);
|
||||||
|
emit tryDelayedSyncCb();
|
||||||
switch (status_code) {
|
return;
|
||||||
case 502:
|
|
||||||
case 504:
|
|
||||||
case 524: {
|
|
||||||
emit trySyncCb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
if (!http::is_logged_in())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (err->matrix_error.errcode ==
|
|
||||||
mtx::errors::ErrorCode::M_UNKNOWN_TOKEN)
|
|
||||||
emit dropToLoginPageCb(msg);
|
|
||||||
else
|
|
||||||
emit tryDelayedSyncCb();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nhlog::net()->debug("sync completed: {}", res.next_batch);
|
nhlog::net()->debug("sync completed: {}", res.next_batch);
|
||||||
|
Loading…
Reference in New Issue
Block a user