parent
7fc33a71fd
commit
0f62cba498
@ -128,7 +128,7 @@ private:
|
|||||||
template<class Collection>
|
template<class Collection>
|
||||||
void updateUserMetadata(const std::vector<Collection> &collection);
|
void updateUserMetadata(const std::vector<Collection> &collection);
|
||||||
|
|
||||||
void retryInitialSync();
|
void retryInitialSync(int status_code = -1);
|
||||||
//! Update the room with the new notification count.
|
//! Update the room with the new notification count.
|
||||||
void updateRoomNotificationCount(const QString &room_id, uint16_t notification_count);
|
void updateRoomNotificationCount(const QString &room_id, uint16_t notification_count);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ signals:
|
|||||||
void getOwnProfileResponse(const QUrl &avatar_url, const QString &display_name);
|
void getOwnProfileResponse(const QUrl &avatar_url, const QString &display_name);
|
||||||
void getOwnCommunitiesResponse(const QList<QString> &own_communities);
|
void getOwnCommunitiesResponse(const QList<QString> &own_communities);
|
||||||
void initialSyncCompleted(const mtx::responses::Sync &response);
|
void initialSyncCompleted(const mtx::responses::Sync &response);
|
||||||
void initialSyncFailed();
|
void initialSyncFailed(int status_code = -1);
|
||||||
void syncCompleted(const mtx::responses::Sync &response);
|
void syncCompleted(const mtx::responses::Sync &response);
|
||||||
void syncFailed(const QString &msg);
|
void syncFailed(const QString &msg);
|
||||||
void joinFailed(const QString &msg);
|
void joinFailed(const QString &msg);
|
||||||
|
@ -361,7 +361,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||||||
});
|
});
|
||||||
|
|
||||||
initialSyncTimer_ = new QTimer(this);
|
initialSyncTimer_ = new QTimer(this);
|
||||||
connect(initialSyncTimer_, &QTimer::timeout, this, &ChatPage::retryInitialSync);
|
connect(initialSyncTimer_, &QTimer::timeout, this, [this]() { retryInitialSync(); });
|
||||||
|
|
||||||
syncTimeoutTimer_ = new QTimer(this);
|
syncTimeoutTimer_ = new QTimer(this);
|
||||||
connect(syncTimeoutTimer_, &QTimer::timeout, this, [this]() {
|
connect(syncTimeoutTimer_, &QTimer::timeout, this, [this]() {
|
||||||
@ -965,19 +965,30 @@ ChatPage::setGroupViewState(bool isEnabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ChatPage::retryInitialSync()
|
ChatPage::retryInitialSync(int status_code)
|
||||||
{
|
{
|
||||||
initialSyncTimer_->stop();
|
initialSyncTimer_->stop();
|
||||||
|
|
||||||
if (client_->getHomeServer().isEmpty()) {
|
if (client_->getHomeServer().isEmpty()) {
|
||||||
deleteConfigs();
|
deleteConfigs();
|
||||||
|
resetUI();
|
||||||
|
emit showLoginPage("Sync error. Please try again.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << "Retrying initial sync";
|
// Retry on Bad-Gateway & Gateway-Timeout errors
|
||||||
|
if (status_code == -1 || status_code == 504 || status_code == 502 || status_code == 524) {
|
||||||
|
qWarning() << "retrying initial sync";
|
||||||
|
|
||||||
client_->initialSync();
|
client_->initialSync();
|
||||||
initialSyncTimer_->start(INITIAL_SYNC_RETRY_TIMEOUT);
|
initialSyncTimer_->start(INITIAL_SYNC_RETRY_TIMEOUT);
|
||||||
|
} else {
|
||||||
|
// Drop into the login screen.
|
||||||
|
deleteConfigs();
|
||||||
|
resetUI();
|
||||||
|
|
||||||
|
emit showLoginPage(QString("Sync error %1. Please try again.").arg(status_code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -401,7 +401,7 @@ MatrixClient::initialSync() noexcept
|
|||||||
|
|
||||||
if (status == 0 || status >= 400) {
|
if (status == 0 || status >= 400) {
|
||||||
qDebug() << "Error code received" << status;
|
qDebug() << "Error code received" << status;
|
||||||
emit initialSyncFailed();
|
emit initialSyncFailed(status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user