From e29b0ada55496138e41f03f3752da39241b46a6f Mon Sep 17 00:00:00 2001 From: PGZXB Date: Thu, 29 Dec 2022 10:52:06 +0800 Subject: [PATCH] Fix --- taichi/cache/metal/cache_manager.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/taichi/cache/metal/cache_manager.cpp b/taichi/cache/metal/cache_manager.cpp index 040a769a046dac..b19238d31883f0 100644 --- a/taichi/cache/metal/cache_manager.cpp +++ b/taichi/cache/metal/cache_manager.cpp @@ -59,13 +59,15 @@ CacheManager::CacheManager(Params &&init_params) if (config_.mode == MemAndDiskCache) { const auto filepath = join_path(config_.cache_path, kMetadataFilename); const auto lock_path = join_path(config_.cache_path, kMetadataLockName); - if (lock_with_file(lock_path)) { - auto _ = make_unlocker(lock_path); - offline_cache::load_metadata_with_checking(cached_data_, filepath); - } else { - TI_WARN( - "Lock {} failed. You can run 'ti cache clean -p {}' and try again.", - lock_path, config_.cache_path); + if (path_exists(filepath)) { + if (lock_with_file(lock_path)) { + auto _ = make_unlocker(lock_path); + offline_cache::load_metadata_with_checking(cached_data_, filepath); + } else { + TI_WARN( + "Lock {} failed. You can run 'ti cache clean -p {}' and try again.", + lock_path, config_.cache_path); + } } } }