Skip to content

Commit

Permalink
Corrected use of seconds instead of ms
Browse files Browse the repository at this point in the history
  • Loading branch information
this-Aditya committed Sep 5, 2024
1 parent 63434e5 commit 203df2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface RemoteConfig {
var lastFetch: Long
val cache: Map<String, String>

fun doFetch(maxCacheAge: Long)
fun doFetch(maxCacheAgeMillis: Long)

fun fetch(maxCacheAge: Long) {
if (lastFetch + maxCacheAge < System.currentTimeMillis()) {
Expand Down

0 comments on commit 203df2e

Please sign in to comment.