diff options
Diffstat (limited to 'cli/npm/registry.rs')
-rw-r--r-- | cli/npm/registry.rs | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs index 585cbe163..907258d3b 100644 --- a/cli/npm/registry.rs +++ b/cli/npm/registry.rs @@ -99,27 +99,6 @@ impl CliNpmRegistryApi { &self.inner().base_url } - /// Marks that new requests for package information should retrieve it - /// from the npm registry - /// - /// Returns true if it was successfully set for the first time. - pub fn mark_force_reload(&self) -> bool { - // never force reload the registry information if reloading - // is disabled or if we're already reloading - if matches!( - self.inner().cache.cache_setting(), - CacheSetting::Only | CacheSetting::ReloadAll - ) { - return false; - } - if self.inner().force_reload_flag.raise() { - self.clear_memory_cache(); // clear the memory cache to force reloading - true - } else { - false - } - } - fn inner(&self) -> &Arc<CliNpmRegistryApiInner> { // this panicking indicates a bug in the code where this // wasn't initialized @@ -154,6 +133,23 @@ impl NpmRegistryApi for CliNpmRegistryApi { } } } + + fn mark_force_reload(&self) -> bool { + // never force reload the registry information if reloading + // is disabled or if we're already reloading + if matches!( + self.inner().cache.cache_setting(), + CacheSetting::Only | CacheSetting::ReloadAll + ) { + return false; + } + if self.inner().force_reload_flag.raise() { + self.clear_memory_cache(); // clear the cache to force reloading + true + } else { + false + } + } } type CacheItemPendingResult = @@ -386,7 +382,7 @@ impl CliNpmRegistryApiInner { name_folder_path.join("registry.json") } - pub fn clear_memory_cache(&self) { + fn clear_memory_cache(&self) { self.mem_cache.lock().clear(); } |