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

download: If we have a last-modified date, set the mtime of the target file #36

Merged
merged 1 commit into from Nov 17, 2016

Conversation

iainlane
Copy link
Collaborator

You know what this is about. :)

…t file

This only works for HTTP, not FTP.

Should hopefully fix asgen considering suites as changed each time,
which I think happened because the Packages file got the current mtime,
so it was always considered to be newer.

Fixes ximion#35
@@ -370,6 +374,10 @@ body
downloader.dataTimeout = dur!"seconds" (30);
downloader.onReceive = (data) => onReceiveCb (dest, data);
downloader.perform();
if ("last-modified" in downloader.responseHeaders) {
Copy link
Owner

Choose a reason for hiding this comment

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

If you want, you can optimize this slightly like this:

immutable lastModifiedP = "last-modified" in downloader.responseHeaders;
if (lastModifiedP !is null) {
    auto lastmodified = *lastModifiedP;
    ret = parseRFC822DateTime(lastmodified);
}

=> one lookup instead of two.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hope that hashing is super fast (and maybe this could be optimised anyway), so this shouldn't really matter...

Copy link
Owner

Choose a reason for hiding this comment

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

It is very fast and I assume the hash table is also pretty small, so this is indeed a micro optimization. Not sure what the compiler does here and how smart it is in optimizing - would be pretty cool if it did optimize that bit :-)

Anyway, this comment was from the "pedantic" and maybe-do-it class of comments ^^

@ximion ximion merged commit c287d96 into ximion:master Nov 17, 2016
@iainlane iainlane deleted the download-mtime branch November 17, 2016 20:23
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.

None yet

2 participants