From 203df2eee7d7f845ff6c2796d757fc9a3b25c1b9 Mon Sep 17 00:00:00 2001 From: this-Aditya Date: Thu, 5 Sep 2024 11:06:59 +0530 Subject: [PATCH] Corrected use of seconds instead of ms --- .../radarbase/android/config/FirebaseRemoteConfiguration.kt | 5 +++-- .../main/java/org/radarbase/android/config/RemoteConfig.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/radar-commons-android/src/main/java/org/radarbase/android/config/FirebaseRemoteConfiguration.kt b/radar-commons-android/src/main/java/org/radarbase/android/config/FirebaseRemoteConfiguration.kt index ed1574b34..e3128ca7f 100644 --- a/radar-commons-android/src/main/java/org/radarbase/android/config/FirebaseRemoteConfiguration.kt +++ b/radar-commons-android/src/main/java/org/radarbase/android/config/FirebaseRemoteConfiguration.kt @@ -70,6 +70,7 @@ class FirebaseRemoteConfiguration(private val context: Context, inDevelopmentMod // activated before newly fetched values are returned. firebase.activate() .addOnSuccessListener { + lastFetch = System.currentTimeMillis() cache = firebase.getKeysByPrefix("") .mapNotNull { key -> firebase.getValue(key).asString() @@ -91,11 +92,11 @@ class FirebaseRemoteConfiguration(private val context: Context, inDevelopmentMod * @param maxCacheAge seconds * @return fetch task or null status is [RadarConfiguration.RemoteConfigStatus.UNAVAILABLE]. */ - override fun doFetch(maxCacheAge: Long) { + override fun doFetch(maxCacheAgeMillis: Long) { if (status == RadarConfiguration.RemoteConfigStatus.UNAVAILABLE) { return } - val task = firebase.fetch(maxCacheAge) + val task = firebase.fetch(maxCacheAgeMillis / 1000L) synchronized(this) { status = RadarConfiguration.RemoteConfigStatus.FETCHING task.addOnSuccessListener(onFetchCompleteHandler) diff --git a/radar-commons-android/src/main/java/org/radarbase/android/config/RemoteConfig.kt b/radar-commons-android/src/main/java/org/radarbase/android/config/RemoteConfig.kt index 713b65b92..5fbd19951 100644 --- a/radar-commons-android/src/main/java/org/radarbase/android/config/RemoteConfig.kt +++ b/radar-commons-android/src/main/java/org/radarbase/android/config/RemoteConfig.kt @@ -10,7 +10,7 @@ interface RemoteConfig { var lastFetch: Long val cache: Map - fun doFetch(maxCacheAge: Long) + fun doFetch(maxCacheAgeMillis: Long) fun fetch(maxCacheAge: Long) { if (lastFetch + maxCacheAge < System.currentTimeMillis()) {