refactor: try to add a retry logic to config sync job in case of snode failure

This commit is contained in:
0x330a 2023-05-04 11:27:49 +10:00
parent 281b8dac33
commit 18f16bc045
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C

View File

@ -19,7 +19,7 @@ data class ConfigurationSyncJob(val destination: Destination): Job {
override var delegate: JobDelegate? = null override var delegate: JobDelegate? = null
override var id: String? = null override var id: String? = null
override var failureCount: Int = 0 override var failureCount: Int = 0
override val maxFailureCount: Int = 1 override val maxFailureCount: Int = 10
val shouldRunAgain = AtomicBoolean(false) val shouldRunAgain = AtomicBoolean(false)
@ -142,7 +142,7 @@ data class ConfigurationSyncJob(val destination: Destination): Job {
} }
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, "Error performing batch request", e) Log.e(TAG, "Error performing batch request", e)
return delegate.handleJobFailedPermanently(this, dispatcherName, e) return delegate.handleJobFailed(this, dispatcherName, e)
} }
delegate.handleJobSucceeded(this, dispatcherName) delegate.handleJobSucceeded(this, dispatcherName)
if (shouldRunAgain.get() && storage.getConfigSyncJob(destination) == null) { if (shouldRunAgain.get() && storage.getConfigSyncJob(destination) == null) {