whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: only fetch bootstrap if not already in the cache
Date Tue, 07 Nov 2017 13:34:44 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys 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 19ebc3b  only fetch bootstrap if not already in the cache
19ebc3b is described below

commit 19ebc3b4a19b3b827a30dce57e15a79c0c53b7a7
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Tue Nov 7 08:34:16 2017 -0500

    only fetch bootstrap if not already in the cache
---
 www/board/agenda/views/models/pagecache.js.rb | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/www/board/agenda/views/models/pagecache.js.rb b/www/board/agenda/views/models/pagecache.js.rb
index 9b79c75..dc7472c 100644
--- a/www/board/agenda/views/models/pagecache.js.rb
+++ b/www/board/agenda/views/models/pagecache.js.rb
@@ -30,17 +30,20 @@ class PageCache
     navigator.serviceWorker.register(scope + 'sw.js', scope)
   end
 
-  # aggressively attempt to preload pages directly used by the agenda pages
+  # ensure that bootstrap.html is in the cache
   # into the appropriate cache.
   def self.preload()
     return unless PageCache.enabled?
 
-    request = Request.new('bootstrap.html', credentials: 'include')
-    fetch(request).then do |response|
-
-      # add/update bootstrap.html in the cache
-      caches.open('board/agenda').then do |cache|
-        cache.put(request, response.clone())
+    caches.open('board/agenda').then do |cache|
+      # add bootstrap.html to the cache
+      request = Request.new('bootstrap.html')
+      cache.match(request).then do |response|
+        unless response
+          fetch(request).then do |response|
+            cache.put(request, response)
+          end
+        end
       end
     end
   end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message