mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Split archive deletes and reconciliations into separate jobs.
This commit is contained in:
@@ -30,10 +30,13 @@ import kotlin.concurrent.withLock
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.days
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
|
||||
/**
|
||||
* A location for accessing remotely-configured values.
|
||||
@@ -428,6 +431,24 @@ object RemoteConfig {
|
||||
)
|
||||
}
|
||||
|
||||
private fun remoteDuration(
|
||||
key: String,
|
||||
defaultValue: Duration,
|
||||
hotSwappable: Boolean,
|
||||
durationUnit: DurationUnit,
|
||||
active: Boolean = true,
|
||||
onChangeListener: OnFlagChange? = null
|
||||
): Config<Duration> {
|
||||
return remoteValue(
|
||||
key = key,
|
||||
hotSwappable = hotSwappable,
|
||||
sticky = false,
|
||||
active = active,
|
||||
onChangeListener = onChangeListener,
|
||||
transformer = { it?.toString()?.toLongOrNull()?.toDuration(durationUnit) ?: defaultValue }
|
||||
)
|
||||
}
|
||||
|
||||
private fun <T : String?> remoteString(
|
||||
key: String,
|
||||
defaultValue: T,
|
||||
@@ -1125,5 +1146,13 @@ object RemoteConfig {
|
||||
inSeconds.seconds.inWholeMilliseconds
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val archiveReconciliationSyncInterval: Duration by remoteDuration(
|
||||
key = "android.archiveReconciliationSyncInterval",
|
||||
defaultValue = 7.days,
|
||||
hotSwappable = true,
|
||||
durationUnit = DurationUnit.DAYS
|
||||
)
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user