Skip to content

Conversation

ta893115871
Copy link

2.fetchContentInfo use http header information for faster

顾修忠 added 2 commits May 8, 2017 13:13
2.fetchContentInfo use http header information for faster
2.fetchContentInfo use http header information for faster
@@ -47,7 +47,7 @@ static void makeDir(File directory) throws IOException {
static void setLastModifiedNow(File file) throws IOException {
if (file.exists()) {
long now = System.currentTimeMillis();
boolean modified = file.setLastModified(now); // on some devices (e.g. Nexus 5) doesn't work
boolean modified = file.setLastModified(now/1000*1000); // on some devices (e.g. Nexus 5) doesn't work
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alway throw new IOException。because in some android device file.setLastModified return false

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ta893115871 please explain you fix. Who and when does throw IOException? Why you divide now to 1000*1000?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can test when the cache file over maxsize limit

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it here and here and here. Can you point to real problem or better write test to proof that my implementation is wrong ?

@danikula
Copy link
Owner

danikula commented May 8, 2017

@ta893115871 some servers doesn't response to HEAD requests. What is why I removed HEAD requests

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

Successfully merging this pull request may close these issues.

2 participants