From 2c4d534846bc757baae16d8ceb3ce052a2cdbca6 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Tue, 12 Sep 2023 23:19:26 +0100 Subject: [PATCH] shorten stale_age for cachefile lock (#51175) (cherry picked from commit 4af6be80f238fce9cd124925d488a4c7171cf74a) --- base/loading.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 90f549b7a5cb91..dd7038845f4f8f 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -2968,11 +2968,13 @@ global parse_pidfile_hook compilecache_pidfile_path(pkg::PkgId) = compilecache_path(pkg, UInt64(0); project="") * ".pidfile" # Allows processes to wait if another process is precompiling a given source already. -# The lock file is deleted and precompilation will proceed after `stale_age` seconds if +# The lock file mtime will be updated when held every `stale_age/2` seconds. +# After `stale_age` seconds beyond the mtime of the lock file, the lock file is deleted and +# precompilation will proceed if # - the locking process no longer exists # - the lock is held by another host, since processes cannot be checked remotely # or after `stale_age * 25` seconds if the process does still exist. -function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=300) +function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=10) if @isdefined(mkpidlock_hook) && @isdefined(trymkpidlock_hook) && @isdefined(parse_pidfile_hook) pidfile = compilecache_pidfile_path(pkg) cachefile = invokelatest(trymkpidlock_hook, f, pidfile; stale_age)