This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new d243d3d8 Allow for test messing with cache setting
d243d3d8 is described below

commit d243d3d86845889cb93ab69b6e7befba8842cc09
Author: Sebb <[email protected]>
AuthorDate: Mon Jan 9 23:01:08 2023 +0000

    Allow for test messing with cache setting
---
 lib/whimsy/asf/documents.rb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
index 680ff9a5..7c78010c 100644
--- a/lib/whimsy/asf/documents.rb
+++ b/lib/whimsy/asf/documents.rb
@@ -6,11 +6,11 @@ module ASF
 
   module DocumentUtils
 
-    CACHE_DIR = ASF::Config.get(:cache)
     MAX_AGE = 600  # 5 minutes
 
+    # N.B. must check :cache config each time to allow for test overrides
     # check cache age and get settings
-    def self.check_cache(type, cache_dir: CACHE_DIR, warn: true)
+    def self.check_cache(type, cache_dir: ASF::Config.get(:cache), warn: true)
       file, _ = ASF::SVN.listingNames(type, cache_dir)
       mtime = begin
         File.mtime(file)
@@ -26,8 +26,9 @@ module ASF
       return [cache_dir, stale, file, age]
     end
 
+    # N.B. must check :cache config each time to allow for test overrides
     # create/update cache file
-    def self.update_cache(type, env, cache_dir: CACHE_DIR)
+    def self.update_cache(type, env, cache_dir: ASF::Config.get(:cache))
       _cache_dir, stale, file, age = check_cache(type, cache_dir: cache_dir, 
warn: false)
       if stale
         require 'whimsy/asf/rack'

Reply via email to