NTP-1234 | Arc | Make Nudge Cache Sync Internal Configurable (#14943)

This commit is contained in:
Shivam Goyal
2025-02-12 20:31:00 +05:30
committed by GitHub
parent c2f8f3269d
commit 7eba567587
3 changed files with 15 additions and 3 deletions

View File

@@ -129,6 +129,8 @@ object FirebaseRemoteConfigHelper {
"NAVI_PAY_REMOVE_APP_ON_INTENT_PAYMENT_SUCCESS"
const val NAVI_PAY_CL_MAX_RETRY_COUNT = "NAVI_PAY_CL_MAX_RETRY_COUNT"
const val NAVI_PAY_GENERIC_OFFERS_TTL_IN_MILLIS = "NAVI_PAY_GENERIC_OFFERS_TTL_IN_MILLIS"
const val NAVI_PAY_ARC_NUDGE_CACHE_SYNC_INTERVAL_IN_MILLIS =
"NAVI_PAY_ARC_NUDGE_CACHE_SYNC_INTERVAL_IN_MILLIS"
// COMMON
const val LITMUS_EXPERIMENTS_CACHE_DURATION_IN_MILLIS =

View File

@@ -16,6 +16,7 @@ import com.navi.base.utils.retry
import com.navi.common.checkmate.model.MetricInfo
import com.navi.common.constants.DBCacheConstants.ARC_NUDGE_RESPONSE_CACHE_KEY
import com.navi.common.constants.DBCacheConstants.ARC_NUDGE_RESPONSE_CACHE_LAST_SYNC_TIMESTAMP_KEY
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
import com.navi.common.network.models.isSuccessWithData
import com.navi.common.payments.arc.model.network.ArcNudgeResponse
import com.navi.common.repo.NaviCommonRepository
@@ -29,8 +30,6 @@ constructor(
@NaviCommonGson private val gson: Gson,
) {
private val ARC_CACHE_MIN_TIMESTAMP = 86400000L // 1 day
suspend fun execute(skipLastSyncedTimestampCheck: Boolean = false) {
val arcResponseCacheLastSyncTs =
@@ -38,7 +37,14 @@ constructor(
val lastSyncedTsDiff =
System.currentTimeMillis() - (arcResponseCacheLastSyncTs?.value?.toLong() ?: 0)
val shouldSync = skipLastSyncedTimestampCheck || lastSyncedTsDiff > ARC_CACHE_MIN_TIMESTAMP
val shouldSync =
skipLastSyncedTimestampCheck ||
lastSyncedTsDiff >
FirebaseRemoteConfigHelper.getLong(
key =
FirebaseRemoteConfigHelper
.NAVI_PAY_ARC_NUDGE_CACHE_SYNC_INTERVAL_IN_MILLIS
)
if (!shouldSync) {
return

View File

@@ -674,4 +674,8 @@
<key>NAVI_PAY_GENERIC_OFFERS_TTL_IN_MILLIS</key>
<value>1800000</value>
</entry>
<entry>
<key>NAVI_PAY_ARC_NUDGE_CACHE_SYNC_INTERVAL_IN_MILLIS</key>
<value>86400000</value>
</entry>
</defaultsMap>