File tree 4 files changed +23
-6
lines changed
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal
4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Improvements 🙌:
9
9
- Handle events of type "m.room.server_acl" (#890 )
10
10
11
11
Bugfix 🐛:
12
+ - F-Droid version: ensure timeout of sync request can be more than 60 seconds (#2169 )
12
13
- Fix issue when restoring draft after sharing (#2287 )
13
14
- Fix issue when updating the avatar of a room (new avatar vanishing)
14
15
- Discard change dialog displayed by mistake when avatar has been updated
Original file line number Diff line number Diff line change @@ -52,5 +52,8 @@ internal class TimeOutInterceptor @Inject constructor() : Interceptor {
52
52
const val CONNECT_TIMEOUT = " CONNECT_TIMEOUT"
53
53
const val READ_TIMEOUT = " READ_TIMEOUT"
54
54
const val WRITE_TIMEOUT = " WRITE_TIMEOUT"
55
+
56
+ // 1 minute
57
+ const val DEFAULT_LONG_TIMEOUT : Long = 60_000
55
58
}
56
59
}
Original file line number Diff line number Diff line change 17
17
package org.matrix.android.sdk.internal.session.sync
18
18
19
19
import org.matrix.android.sdk.internal.network.NetworkConstants
20
+ import org.matrix.android.sdk.internal.network.TimeOutInterceptor
20
21
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
21
22
import retrofit2.Call
22
23
import retrofit2.http.GET
23
- import retrofit2.http.Headers
24
+ import retrofit2.http.Header
24
25
import retrofit2.http.QueryMap
25
26
26
27
internal interface SyncAPI {
27
-
28
28
/* *
29
- * Set all the timeouts to 1 minute
29
+ * Set all the timeouts to 1 minute by default
30
30
*/
31
- @Headers(" CONNECT_TIMEOUT:60000" , " READ_TIMEOUT:60000" , " WRITE_TIMEOUT:60000" )
32
31
@GET(NetworkConstants .URI_API_PREFIX_PATH_R0 + " sync" )
33
- fun sync (@QueryMap params : Map <String , String >): Call <SyncResponse >
32
+ fun sync (@QueryMap params : Map <String , String >,
33
+ @Header(TimeOutInterceptor .CONNECT_TIMEOUT ) connectTimeOut : Long = TimeOutInterceptor .DEFAULT_LONG_TIMEOUT ,
34
+ @Header(TimeOutInterceptor .READ_TIMEOUT ) readTimeOut : Long = TimeOutInterceptor .DEFAULT_LONG_TIMEOUT ,
35
+ @Header(TimeOutInterceptor .WRITE_TIMEOUT ) writeTimeOut : Long = TimeOutInterceptor .DEFAULT_LONG_TIMEOUT
36
+ ): Call <SyncResponse >
34
37
}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.session.sync
19
19
import org.greenrobot.eventbus.EventBus
20
20
import org.matrix.android.sdk.R
21
21
import org.matrix.android.sdk.internal.di.UserId
22
+ import org.matrix.android.sdk.internal.network.TimeOutInterceptor
22
23
import org.matrix.android.sdk.internal.network.executeRequest
23
24
import org.matrix.android.sdk.internal.session.DefaultInitialSyncProgressService
24
25
import org.matrix.android.sdk.internal.session.filter.FilterRepository
@@ -78,13 +79,22 @@ internal class DefaultSyncTask @Inject constructor(
78
79
// Maybe refresh the home server capabilities data we know
79
80
getHomeServerCapabilitiesTask.execute(Unit )
80
81
82
+ val readTimeOut = (params.timeout + TIMEOUT_MARGIN ).coerceAtLeast(TimeOutInterceptor .DEFAULT_LONG_TIMEOUT )
83
+
81
84
val syncResponse = executeRequest<SyncResponse >(eventBus) {
82
- apiCall = syncAPI.sync(requestParams)
85
+ apiCall = syncAPI.sync(
86
+ params = requestParams,
87
+ readTimeOut = readTimeOut
88
+ )
83
89
}
84
90
syncResponseHandler.handleResponse(syncResponse, token)
85
91
if (isInitialSync) {
86
92
initialSyncProgressService.endAll()
87
93
}
88
94
Timber .v(" Sync task finished on Thread: ${Thread .currentThread().name} " )
89
95
}
96
+
97
+ companion object {
98
+ private const val TIMEOUT_MARGIN : Long = 10_000
99
+ }
90
100
}
You can’t perform that action at this time.
0 commit comments