From 0e00f6f74041a5fec528d1511095ea4974150239 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 21 Mar 2017 19:01:35 +0900 Subject: Jobs retry on network and timeout errors As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly). --- connection.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'connection.h') diff --git a/connection.h b/connection.h index 55b688a2..70a2eeaa 100644 --- a/connection.h +++ b/connection.h @@ -71,6 +71,8 @@ namespace QMatrixClient /** @deprecated Use accessToken() instead. */ Q_INVOKABLE QString token() const; Q_INVOKABLE QString accessToken() const; + Q_INVOKABLE SyncJob* syncJob() const; + Q_INVOKABLE int millisToReconnect() const; template JobT* callApi(JobArgTs... jobArgs) -- cgit v1.2.3 From 2f57ea69098fee6a5f90ec35ebac89a26ef8efeb Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 25 Mar 2017 14:33:01 +0900 Subject: Stop sync upon successful logout --- connection.h | 1 + 1 file changed, 1 insertion(+) (limited to 'connection.h') diff --git a/connection.h b/connection.h index 70a2eeaa..a00afc91 100644 --- a/connection.h +++ b/connection.h @@ -54,6 +54,7 @@ namespace QMatrixClient Q_INVOKABLE virtual void logout(); Q_INVOKABLE virtual void sync(int timeout=-1); + Q_INVOKABLE virtual void stopSync(); /** @deprecated Use callApi() or Room::postMessage() instead */ Q_INVOKABLE virtual void postMessage( Room* room, QString type, QString message ); /** @deprecated Use callApi() or Room::postReceipt() instead */ -- cgit v1.2.3 From 6895d14865c44b6dd6cf138a6a7413c6337b9802 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 25 Mar 2017 18:08:28 +0900 Subject: Split connectionError into networkError and syncError When SyncJob retries, networkError is emitted; if it fails entirely, either loginError or syncError, depending on the kind of failure. --- connection.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'connection.h') diff --git a/connection.h b/connection.h index a00afc91..849106a1 100644 --- a/connection.h +++ b/connection.h @@ -94,8 +94,9 @@ namespace QMatrixClient void joinedRoom(Room* room); void loginError(QString error); - void connectionError(QString error); + void networkError(size_t nextAttempt, int inMilliseconds); void resolveError(QString error); + void syncError(QString error); //void jobError(BaseJob* job); protected: -- cgit v1.2.3