aws/aws-cli — pull request #994 by kirat-singh (2014-11-10 18:31:23+00:00)
Title: fix for aws s3 sync intermittently setting mtime on a large multipart download to now

Hi folks,

I've noticed a lot of unnecessary downloads with aws s3 sync but only for large multi-part files.

Looking over the code I see that CompleteDownloadTask in awscli/customizations/s3/tasks.py sets the file mtime before it is closed.

I can't reliably reproduce it, but off-hand this seems wrong. I suspect the file has unflushed data, and closing it updates the mtime to now.

So I've made a pretty straightforward fix where IOCloseRequest takes an optional last_updated. If this is not None, then after the file is closed the IOWriterThread sets the mtime. And I removed the os.utime call in CompleteDownloadTask since it is now redundant.

In my tests I could not reproduce the problem after the fix was applied.

Please let me know if this is a reasonable change and apologies in advance if I haven't followed protocol, this is the first time I've submitted a pull request here.

best,
-Kirat