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 fdaba91 cleanup cache
fdaba91 is described below
commit fdaba9160717c17cba77d542567c0c67e952860b
Author: Sam Ruby <[email protected]>
AuthorDate: Tue Jun 5 20:34:39 2018 -0400
cleanup cache
---
www/board/agenda/views/models/pagecache.js.rb | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/www/board/agenda/views/models/pagecache.js.rb
b/www/board/agenda/views/models/pagecache.js.rb
index 0d0b0e1..df20dc8 100644
--- a/www/board/agenda/views/models/pagecache.js.rb
+++ b/www/board/agenda/views/models/pagecache.js.rb
@@ -71,6 +71,26 @@ class PageCache
end
end
end
+
+ self.cleanup(scope.toString(), Server.agendas)
+ end
+
+ # remove cached pages associated with agendas that are no longer present
+ def self.cleanup(scope, agendas)
+ agendas = agendas.map {|agenda| agenda[/\d\d\d\d_\d\d_\d\d/].gsub('_',
'-')}
+
+ caches.open('board/agenda').then do |cache|
+ cache.matchAll().then do |responses|
+ urls = responses.map {|response| response.url}.select do |url|
+ part = url[scope.length..-1].split('/')[0].split('.')[0]
+ part =~ /^\d\d\d\d-\d\d-\d\d$/ && !agendas.include?(part)
+ end
+
+ urls.each do |url|
+ cache.delete(url).then {}
+ end
+ end
+ end
end
# if the entry point URL is /latest/, the service worker will optimistically
--
To stop receiving notification emails like this one, please contact
[email protected].