vfs: set the modtime of the cache file immediately

Before this change we set the modtime of the cache file when all
writers had finished.

This has the unfortunate effect that the file is uploaded with the
wrong modtime which means on backends which can't set modtimes except
when uploading files it is wrong.

This change sets the modtime of the cache file immediately in the
cache and in turn sets the modtime in the file info.
This commit is contained in:
Nick Craig-Wood
2020-08-20 16:24:04 +01:00
parent 9d3d397f50
commit 94a0991584
3 changed files with 11 additions and 7 deletions
+1
View File
@@ -877,6 +877,7 @@ func (item *Item) setModTime(modTime time.Time) {
item.mu.Lock()
item._updateFingerprint()
item._setModTime(modTime)
item.info.ModTime = modTime
err := item._save()
if err != nil {
fs.Errorf(item.name, "vfs cache: setModTime: failed to save item info: %v", err)