mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 18:39:16 +01:00
[download-cache] Fixed init logic to skip when cache file is missing (#10362)
There are several possible causes of the cache file to not exist, including user action. By skipping these couple steps during initialization when the file is missing, a renew action is allowed to start and the cache will rebuild and hopefully work as expected. Simple fix for #10360
This commit is contained in:
parent
b1067b942e
commit
7292dadd5f
@ -103,12 +103,15 @@ class DownloadCache(
|
||||
scope.launch {
|
||||
rootDownloadsDirLock.withLock {
|
||||
try {
|
||||
if (diskCacheFile.exists()) {
|
||||
val diskCache = diskCacheFile.inputStream().use {
|
||||
ProtoBuf.decodeFromByteArray<RootDirectory>(it.readBytes())
|
||||
}
|
||||
rootDownloadsDir = diskCache
|
||||
lastRenew = System.currentTimeMillis()
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e) { "Failed to initialize disk cache" }
|
||||
diskCacheFile.delete()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user