Skip to content

Commit

Permalink
Add missing flush calls to DiskLruCache. (#2684)
Browse files Browse the repository at this point in the history
* Add missing flush calls to DiskLruCache.

* Clean up.
  • Loading branch information
colinrtwhite authored Nov 14, 2024
1 parent f93ac43 commit 49b92e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion coil-core/src/commonMain/kotlin/coil3/disk/DiskLruCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ internal class DiskLruCache(
writeByte(' '.code)
writeUtf8(key)
writeByte('\n'.code)
flush()
}

if (journalRewriteRequired()) {
Expand Down Expand Up @@ -519,7 +520,9 @@ internal class DiskLruCache(

val entry = lruEntries[key] ?: return false
val removed = removeEntry(entry)
if (removed && size <= maxSize) mostRecentTrimFailed = false
if (removed && size <= maxSize) {
mostRecentTrimFailed = false
}
return removed
}

Expand Down Expand Up @@ -553,6 +556,7 @@ internal class DiskLruCache(
writeByte(' '.code)
writeUtf8(entry.key)
writeByte('\n'.code)
flush()
}
lruEntries.remove(entry.key)

Expand Down

0 comments on commit 49b92e9

Please sign in to comment.