Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow explicit sw de-registering + timebomb #100

Merged
merged 11 commits into from
Mar 14, 2024
Merged

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Mar 12, 2024

I will be deploying these changes to sw.sgtpooki.com so it can be used for testing

@SgtPooki SgtPooki linked an issue Mar 12, 2024 that may be closed by this pull request
@SgtPooki SgtPooki changed the title feat: allow explicit sw de-registering feat: allow explicit sw de-registering + timebomb Mar 12, 2024
@SgtPooki SgtPooki marked this pull request as ready for review March 12, 2024 21:40
@SgtPooki SgtPooki requested review from lidel and 2color March 12, 2024 21:40
@SgtPooki
Copy link
Member Author

SgtPooki commented Mar 12, 2024

FYI that the latest changes, i.e. fe32830 (#100), except that the timebomb is set to 30seconds (see below) have been deployed to https://sw.sgtpooki.com

╰─ ✔ ❯ git add -p                                                                                                                                     3.73   24.4G   52%   100%  ─╯
Alias tip: g add -p
diff --git a/src/sw.ts b/src/sw.ts
index f859e19..8ec8a02 100644
--- a/src/sw.ts
+++ b/src/sw.ts
@@ -291,7 +291,7 @@ async function isTimebombExpired (): Promise<boolean> {
   firstInstallTime = firstInstallTime ?? await getInstallTimestamp()
   const now = Date.now()
   // max life (for now) is 24 hours
-  const timebomb = 24 * 60 * 60 * 1000
+  const timebomb = 30 * 1000
   return now - firstInstallTime > timebomb
 }

This should help with testing. See a demo below:

2024-03-12.at.15.54.57.-.Coffee.Galliform.mp4

Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review & local testing of cache && 10sec timebomb

@SgtPooki SgtPooki merged commit 8ec199c into main Mar 14, 2024
21 checks passed
@SgtPooki SgtPooki deleted the 26-update-mechanisms branch March 14, 2024 20:48
@lidel lidel mentioned this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update mechanisms
1 participant