Skip to content

Commit 6ff60c6

Browse files
committed
Don't attempt to update cache entries on Windows.
1 parent 34f1be9 commit 6ff60c6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ext/bootsnap/bootsnap.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#define RB_UNLIKELY(x) (x)
3939
#endif
4040

41+
#ifdef HAVE_FDATASYNC
42+
#define BS_REVALIDATE_CACHE 1
43+
#endif
44+
4145
/*
4246
* An instance of this key is written as the first 64 bytes of each cache file.
4347
* The mtime and size members track whether the file contents have changed, and
@@ -319,7 +323,15 @@ static enum cache_status cache_key_equal_fast_path(struct bs_cache_key *k1,
319323
k1->ruby_platform == k2->ruby_platform &&
320324
k1->compile_option == k2->compile_option &&
321325
k1->ruby_revision == k2->ruby_revision && k1->size == k2->size) {
322-
return (k1->mtime == k2->mtime) ? hit : stale;
326+
if (k1->mtime == k2->mtime) {
327+
return hit;
328+
} else {
329+
#ifdef BS_REVALIDATE_CACHE
330+
return stale;
331+
#else
332+
return miss;
333+
#endif
334+
}
323335
}
324336
return miss;
325337
}

0 commit comments

Comments
 (0)