瀏覽代碼

WalledCheckCache: use current epoch instead of millis since boot to avoid problems on reboot

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 2 年之前
父節點
當前提交
b32ea65774
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/src/main/java/com/nextcloud/client/network/WalledCheckCache.kt

+ 2 - 2
app/src/main/java/com/nextcloud/client/network/WalledCheckCache.kt

@@ -36,7 +36,7 @@ class WalledCheckCache @Inject constructor(private val clock: Clock) {
         return when (val timestamp = cachedEntry?.first) {
         return when (val timestamp = cachedEntry?.first) {
             null -> true
             null -> true
             else -> {
             else -> {
-                val diff = clock.millisSinceBoot - timestamp
+                val diff = clock.currentTime - timestamp
                 diff >= CACHE_TIME_MS
                 diff >= CACHE_TIME_MS
             }
             }
         }
         }
@@ -44,7 +44,7 @@ class WalledCheckCache @Inject constructor(private val clock: Clock) {
 
 
     @Synchronized
     @Synchronized
     fun setValue(isWalled: Boolean) {
     fun setValue(isWalled: Boolean) {
-        this.cachedEntry = Pair(clock.millisSinceBoot, isWalled)
+        this.cachedEntry = Pair(clock.currentTime, isWalled)
     }
     }
 
 
     @Synchronized
     @Synchronized