Ignore delayed job and sidekiq dashboards (#5262)
This commit is contained in:
parent
420b42e656
commit
b45f35d044
1 changed files with 8 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
// Serviceworkers file. This code gets installed in users browsers and runs code before the request is made.
|
// Serviceworkers file. This code gets installed in users browsers and runs code before the request is made.
|
||||||
<% unless Rails.env.test? %>
|
<% unless Rails.env.test? %>
|
||||||
const staticCacheName = 'static-1.1';
|
const staticCacheName = 'static-1.2';
|
||||||
const expectedCaches = [
|
const expectedCaches = [
|
||||||
staticCacheName
|
staticCacheName
|
||||||
];
|
];
|
||||||
|
|
@ -86,7 +86,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (url.origin === location.origin) {
|
if (url.origin === location.origin) {
|
||||||
//
|
|
||||||
if (event.clientId === "" && // Not fetched via AJAX after page load.
|
if (event.clientId === "" && // Not fetched via AJAX after page load.
|
||||||
event.request.method == "GET" && // Don't fetch on POST, DELETE, etc.
|
event.request.method == "GET" && // Don't fetch on POST, DELETE, etc.
|
||||||
!event.request.referrer.includes('/signout_confirm') && // If this is the referrer, we instead want to flush.
|
!event.request.referrer.includes('/signout_confirm') && // If this is the referrer, we instead want to flush.
|
||||||
|
|
@ -102,18 +101,21 @@
|
||||||
!url.href.includes('/internal') && // Don't fetch for internal dashboard.
|
!url.href.includes('/internal') && // Don't fetch for internal dashboard.
|
||||||
!url.href.includes('/future') && // Skip for /future.
|
!url.href.includes('/future') && // Skip for /future.
|
||||||
!url.href.includes('?preview=') && // Skip for /future.
|
!url.href.includes('?preview=') && // Skip for /future.
|
||||||
|
!url.href.includes('/delayed_job') && // Skip for Delayed Job dashboard
|
||||||
|
!url.href.includes('/sidekiq') && // Skip for Sidekiq dashboard
|
||||||
caches.match('/shell_top') && // Ensure shell_top is in the cache.
|
caches.match('/shell_top') && // Ensure shell_top is in the cache.
|
||||||
caches.match('/shell_bottom')) { // Ensure shell_bottom is in the cache.
|
caches.match('/shell_bottom')) { // Ensure shell_bottom is in the cache.
|
||||||
event.respondWith(createPageStream(event.request)); // Respond with the stream
|
event.respondWith(createPageStream(event.request)); // Respond with the stream
|
||||||
|
|
||||||
// Ping version endpoint to see if we should fetch new shell.
|
// Ping version endpoint to see if we should fetch new shell.
|
||||||
if (!caches.match('/async_info/shell_version')) { // Check if we have a cached shell version
|
if (!caches.match('/async_info/shell_version')) { // Check if we have a cached shell version
|
||||||
caches.open(staticCacheName)
|
caches.open(staticCacheName)
|
||||||
.then(cache => cache.addAll([
|
.then(cache => cache.addAll([
|
||||||
"/async_info/shell_version",
|
"/async_info/shell_version",
|
||||||
]))
|
]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('/async_info/shell_version').then(response => response.json()).then(json => {
|
fetch('/async_info/shell_version').then(response => response.json()).then(json => {
|
||||||
caches.match('/async_info/shell_version').then(cachedResponse => cachedResponse.json()).then(cacheJson => {
|
caches.match('/async_info/shell_version').then(cachedResponse => cachedResponse.json()).then(cacheJson => {
|
||||||
if (cacheJson['version'] != json['version']) {
|
if (cacheJson['version'] != json['version']) {
|
||||||
|
|
@ -122,7 +124,7 @@
|
||||||
"/shell_top",
|
"/shell_top",
|
||||||
"/shell_bottom",
|
"/shell_bottom",
|
||||||
"/async_info/shell_version"
|
"/async_info/shell_version"
|
||||||
]))
|
]));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -136,7 +138,7 @@
|
||||||
.then(cache => cache.addAll([
|
.then(cache => cache.addAll([
|
||||||
"/shell_top",
|
"/shell_top",
|
||||||
"/shell_bottom",
|
"/shell_bottom",
|
||||||
]))
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue