square / picasso

A powerful image downloading and caching library for Android
https://square.github.io/picasso/
Apache License 2.0
18.7k stars 3.97k forks source link

Blue indicator misleading #1157

Open hanbo opened 8 years ago

hanbo commented 8 years ago

The blue indicator (loading image from disk cache) is a bit misleading.

When there is a version of the image already on the disk, but it isn't fresh anymore (max-age or expire time are exceeded) it gets validated and possibly downloaded when it changed (newer last modified date or ETAG). But still Picasso shows a blue icon. Thats misleading.

I noticed that on a S6 with slow scrolling performance, although all images where displayed with green and blue icons. And found out with a traffic analyzer that the images get continuously redownloaded while scrolling.

It would be nice if there where more colors for different cases, like blue for served from disk without revalidation (still fresh), yellow served from cache but validated and got a not modified server response and orange for validation resulted in a new image content from the server.

JakeWharton commented 8 years ago

When there is a version of the image already on the disk, but it isn't fresh anymore (max-age or expire time are exceeded) it gets validated and possibly downloaded when it changed (newer last modified date or ETAG). But still Picasso shows a blue icon.

This is incorrect. If the server returns 304 then blue is used, otherwise the image is downloaded and red is used.

hanbo commented 8 years ago

That's what i was assuming, but it is not happening that way. Please verify for yourself. I use version 2.5.2 and okhttp 2.5.0 I get blue indicators when the image was on disk but got downloaded again due to exceeding caching headers and changed content.

hanbo commented 8 years ago

The strange thing is it doesn't always happen this way. I will investigate that further next week.

hanbo commented 8 years ago

I still have this issue. I will make a video illustrating the problem tomorrow. It could be connected with some timing issue. I observed when the time on the phone is a little bit in the future and the server serves an image with Last Modified date at current time then successive requests redownload the image but picasso (falsely) shows blue indicators.