Skip to content

Commit

Permalink
analysis(ServiceWorker): wrong entries in CacheStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
skydever committed Jan 26, 2018
1 parent 92d88a5 commit 55d44e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions sw-app-one/dist-sw/sw-app-one/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ngsw-worker.js
18 changes: 9 additions & 9 deletions sw-app-one/dist-sw/sw-app-one/ngsw-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,9 +1975,9 @@ class Driver {
try {
// Read them from the DB simultaneously.
[manifests, assignments, latest] = await Promise.all([
table.read('manifestsSwAppOne'),
table.read('assignmentsSwAppOne'),
table.read('latestSwAppOne'),
table.read('manifests'),
table.read('assignments'),
table.read('latest'),
]);
// Successfully loaded from saved state. This implies a manifest exists, so
// the update check needs to happen in the background.
Expand All @@ -2003,9 +2003,9 @@ class Driver {
latest = { latest: hash };
// Save the initial state to the DB.
await Promise.all([
table.write('manifestsSwAppOne', manifests),
table.write('assignmentsSwAppOne', assignments),
table.write('latestSwAppOne', latest),
table.write('manifests', manifests),
table.write('assignments', assignments),
table.write('latest', latest),
]);
}
// At this point, either the state has been loaded successfully, or fresh state
Expand Down Expand Up @@ -2284,9 +2284,9 @@ class Driver {
};
// Synchronize all of these.
await Promise.all([
table.write('manifestsSwAppOne', manifests),
table.write('assignmentsSwAppOne', assignments),
table.write('latestSwAppOne', latest),
table.write('manifests', manifests),
table.write('assignments', assignments),
table.write('latest', latest),
]);
}
async cleanupCaches() {
Expand Down
18 changes: 9 additions & 9 deletions sw-app-one/dist-sw/sw-app-two/ngsw-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,9 +1975,9 @@
try {
// Read them from the DB simultaneously.
[manifests, assignments, latest] = await Promise.all([
table.read('manifestsSwAppTwo'),
table.read('assignmentsSwAppTwo'),
table.read('latestSwAppTwo'),
table.read('manifests'),
table.read('assignments'),
table.read('latest'),
]);
// Successfully loaded from saved state. This implies a manifest exists, so
// the update check needs to happen in the background.
Expand All @@ -2003,9 +2003,9 @@
latest = { latest: hash };
// Save the initial state to the DB.
await Promise.all([
table.write('manifestsSwAppTwo', manifests),
table.write('assignmentsSwAppTwo', assignments),
table.write('latestSwAppTwo', latest),
table.write('manifests', manifests),
table.write('assignments', assignments),
table.write('latest', latest),
]);
}
// At this point, either the state has been loaded successfully, or fresh state
Expand Down Expand Up @@ -2284,9 +2284,9 @@
};
// Synchronize all of these.
await Promise.all([
table.write('manifestsSwAppTwo', manifests),
table.write('assignmentsSwAppTwo', assignments),
table.write('latestSwAppTwo', latest),
table.write('manifests', manifests),
table.write('assignments', assignments),
table.write('latest', latest),
]);
}
async cleanupCaches() {
Expand Down

0 comments on commit 55d44e2

Please sign in to comment.