PERF: cache service worker for 1 hour

This commit is contained in:
Sam 2017-12-28 08:31:01 +11:00
parent f5e170c6b5
commit 5ad1709dba
1 changed files with 4 additions and 0 deletions

View File

@ -147,6 +147,10 @@ class StaticController < ApplicationController
def service_worker_asset
respond_to do |format|
format.js do
# we take 1 hour to give a new service worker to all users
immutable_for 1.hour
render(
plain: Rails.application.assets_manifest.find_sources('service-worker.js').first,
content_type: 'application/javascript'