From: Joel Rosdahl Date: Thu, 6 Jun 2019 12:53:40 +0000 (+0200) Subject: Move mtime update into result_get/manifest_get X-Git-Tag: v4.0~951 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7fdaedcfb0e7358d5baebea5f078045b216771a;p=thirdparty%2Fccache.git Move mtime update into result_get/manifest_get Housekeeping of cached files belongs to the backend code, not the frontend. --- diff --git a/src/ccache.c b/src/ccache.c index 249f1699d..e0288d952 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -2062,7 +2062,6 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode) MTR_END("manifest", "manifest_get"); if (object_hash) { cc_log("Got object file hash from manifest"); - update_mtime(manifest_path); } else { cc_log("Did not find object file hash in manifest"); } @@ -2174,10 +2173,6 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest) MTR_END("file", "file_get"); - // Update modification timestamp to save files from LRU cleanup. Also gives - // files a sensible mtime when hard-linking. - update_mtime(cached_result); - send_cached_stderr(tmp_stderr); if (put_object_in_manifest) { diff --git a/src/manifest.c b/src/manifest.c index 9d614f94b..6672f4027 100644 --- a/src/manifest.c +++ b/src/manifest.c @@ -646,6 +646,10 @@ out: if (mf) { free_manifest(mf); } + if (fh) { + // Update modification timestamp to save files from LRU cleanup. + update_mtime(manifest_path); + } return fh; } diff --git a/src/result.c b/src/result.c index 94bf6e2f7..75ab420ee 100644 --- a/src/result.c +++ b/src/result.c @@ -389,6 +389,10 @@ bool result_get(const char *path, struct filelist *list) cc_log("Error: %s", errmsg); free(errmsg); } + if (success) { + // Update modification timestamp to save files from LRU cleanup. + update_mtime(path); + } return success; }