Skip to content

Commit

Permalink
isInDiskCache operation unknown will use dynamic size based on MC
Browse files Browse the repository at this point in the history
Reviewed By: defHLT

Differential Revision: D66241837

fbshipit-source-id: d576d74108df7108a93dbc9541781f2279e1ea50
  • Loading branch information
Veeren Mandalia authored and facebook-github-bot committed Nov 21, 2024
1 parent 9be22e8 commit 3448ce1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ constructor(override val prefetchConfig: PrefetchConfig = DefaultPrefetchConfig(

override fun experimentalDynamicSizeDiskCacheCheckTimeoutMs(): Long = 0

override fun experimentalDynamicSizeUseSfOnDiskCacheTimeout(): Boolean = false

override fun isAppStarting(): Boolean = false

override fun experimentalDynamicSizeDisableWhenAppIsStarting(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ interface FrescoVitoConfig {

fun experimentalDynamicSizeDiskCacheCheckTimeoutMs(): Long

fun experimentalDynamicSizeUseSfOnDiskCacheTimeout(): Boolean

fun isAppStarting(): Boolean

fun experimentalDynamicSizeDisableWhenAppIsStarting(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ object FrescoVitoImage2Spec {
requestCachedValue,
FrescoVitoProvider.getConfig().experimentalDynamicSizeDiskCacheCheckTimeoutMs(),
TimeUnit.MILLISECONDS)
// Force keep original size if in disk cache OR unknown result (null)
forceKeepOriginalSize.set(isInDiskCache != false)
if (isInDiskCache == null) {
// On timeout, force keep original size by default
forceKeepOriginalSize.set(
!FrescoVitoProvider.getConfig().experimentalDynamicSizeUseSfOnDiskCacheTimeout())
} else {
forceKeepOriginalSize.set(isInDiskCache)
}
}
if (forceKeepOriginalSize.get() == true) {
// Tell image pipeline that we're using an unmodified URL so it can ensure we can prefetch
Expand Down

0 comments on commit 3448ce1

Please sign in to comment.