Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk Cache Not Working w/ 3.0.0-alpha3 #2352

Open
herriojr opened this issue Jan 31, 2023 · 0 comments
Open

Disk Cache Not Working w/ 3.0.0-alpha3 #2352

herriojr opened this issue Jan 31, 2023 · 0 comments

Comments

@herriojr
Copy link

herriojr commented Jan 31, 2023

With Picasso 3.0.0-alpha3, when I do the following:

            picasso.load("https://some/image/url")
                .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
                .fetch(object : Callback {
                    override fun onError(t: Throwable) {
                        Log.d("TAG", "Failed")
                        t.printStackTrace()
                    }

                    override fun onSuccess() {
                        Log.d("TAG", "Success")
                    }
                })

If I wait for the fetch to succeed, then do the following:

            picasso.load("https://some/image/url")
                .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
                .networkPolicy(NetworkPolicy.OFFLINE)
                .fetch(object : Callback {
                    override fun onError(t: Throwable) {
                        Log.d("TAG", "Failed")
                        t.printStackTrace()
                    }

                    override fun onSuccess() {
                        Log.d("TAG", "Success")
                    }
                })

The second fetch fails with a 504. It appears that even though the first fetch() was supposed to disk cache, it never actually does. When I look into it further, it appears the currentEditor on the DiskLruCache's entity is not being completed at all and just gets stuck open. I don't know exactly where, but it appears that the source needs to be closed so the cached item can be committed.

Further investigation shows that the disk cache just isn't being used at all in api 26, which I'm assuming it's api < 28 that has this issue since that's the only version check I see in the picasso codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant