Skip to content

Commit

Permalink
[7.4.0] Use NOW_SENTINEL_TIME when refreshing the mtime on a disk cac…
Browse files Browse the repository at this point in the history
…he entry. (bazelbuild#23739)

Fixes bazelbuild#23512.

PiperOrigin-RevId: 678162004
Change-Id: If94854fa02a4ae457507e3d2b20227871f88b068
  • Loading branch information
tjgq authored Sep 24, 2024
1 parent 6b95332 commit 3c71860
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.time.Instant;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -119,7 +118,9 @@ public DiskCacheClient(
*/
public boolean refresh(Path path) throws IOException {
try {
path.setLastModifiedTime(Instant.now().toEpochMilli());
// Use NOW_SENTINEL_TIME instead of obtaining the current time so that the operation succeeds
// even when the file has a different owner, as might be the case for a shared cache.
path.setLastModifiedTime(Path.NOW_SENTINEL_TIME);
} catch (FileNotFoundException e) {
return false;
}
Expand Down

0 comments on commit 3c71860

Please sign in to comment.