Compare commits
4 Commits
develop
...
feature/bc
Author | SHA1 | Date | |
---|---|---|---|
|
0803f25a32 | ||
|
7ad39fdc99 | ||
|
301ab2af64 | ||
|
605cbb0b55 |
1
changelog.d/6050.sdk
Normal file
1
changelog.d/6050.sdk
Normal file
@ -0,0 +1 @@
|
||||
Default sync timeout is now configurable via MatrixConfiguration (no change to default)
|
@ -96,7 +96,8 @@ class CommonTestHelper private constructor(context: Context) {
|
||||
context,
|
||||
MatrixConfiguration(
|
||||
applicationFlavor = "TestFlavor",
|
||||
roomDisplayNameFallbackProvider = TestRoomDisplayNameFallbackProvider()
|
||||
roomDisplayNameFallbackProvider = TestRoomDisplayNameFallbackProvider(),
|
||||
syncRequestTimeoutMillis = 5_000L
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -65,4 +65,11 @@ data class MatrixConfiguration(
|
||||
* Thread messages default enable/disabled value.
|
||||
*/
|
||||
val threadMessagesEnabledDefault: Boolean = false,
|
||||
|
||||
/**
|
||||
* Server API configuration for the sync process:
|
||||
* The maximum time to wait by the homeserver, in milliseconds, before returning the sync response.
|
||||
* If no events (or other data) become available before this time elapses, the server will return a response with empty fields.
|
||||
*/
|
||||
val syncRequestTimeoutMillis: Long = 30_000L,
|
||||
)
|
||||
|
@ -30,6 +30,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.matrix.android.sdk.api.MatrixConfiguration
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import org.matrix.android.sdk.api.failure.isTokenError
|
||||
@ -52,7 +53,6 @@ import javax.inject.Inject
|
||||
import kotlin.concurrent.schedule
|
||||
|
||||
private const val RETRY_WAIT_TIME_MS = 10_000L
|
||||
private const val DEFAULT_LONG_POOL_TIMEOUT = 30_000L
|
||||
|
||||
private val loggerTag = LoggerTag("SyncThread", LoggerTag.SYNC)
|
||||
|
||||
@ -61,7 +61,7 @@ internal class SyncThread @Inject constructor(
|
||||
private val networkConnectivityChecker: NetworkConnectivityChecker,
|
||||
private val backgroundDetectionObserver: BackgroundDetectionObserver,
|
||||
private val activeCallHandler: ActiveCallHandler,
|
||||
private val lightweightSettingsStorage: DefaultLightweightSettingsStorage
|
||||
private val lightweightSettingsStorage: DefaultLightweightSettingsStorage,
|
||||
) : Thread("SyncThread"), NetworkConnectivityChecker.Listener, BackgroundDetectionObserver.Listener {
|
||||
|
||||
private var state: SyncState = SyncState.Idle
|
||||
@ -181,7 +181,7 @@ internal class SyncThread @Inject constructor(
|
||||
val timeout = when {
|
||||
previousSyncResponseHasToDevice -> 0L /* Force timeout to 0 */
|
||||
afterPause -> 0L /* No timeout after a pause */
|
||||
else -> DEFAULT_LONG_POOL_TIMEOUT
|
||||
else -> matrixConfiguration.syncRequestTimeoutMillis
|
||||
}
|
||||
Timber.tag(loggerTag.value).d("Execute sync request with timeout $timeout")
|
||||
val presence = lightweightSettingsStorage.getSyncPresenceStatus()
|
||||
|
Loading…
x
Reference in New Issue
Block a user