-
Notifications
You must be signed in to change notification settings - Fork 312
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
Formalizing a timeout API #1292
Comments
I don't think we need a timeout for |
@jakearchibald true. A At the end of the day, it would be nice to have some sort of built-in safeguard against locking up a service worker with a never-ending operation. If we just pick one safeguard, I think |
Agree skipWaiting(timeout) or skipWaiting(force) would be interesting. Chrome has a built-in timeout, as mentioned in #1295 |
It would also be nice if the |
F2F: This and related issues was discussed at the F2F, see a summary at #1303 (comment) I'll add that if we're removing resurrection then having unregister({force: true}) would provide a means of avoiding the new worker stomping on the storage of an old but still used worker. |
At the F2F, we also discussed a built-in API for adding a timeout for cc @n8schloss |
Would it make sense to reuse |
@annevk sorry I neglected to respond to your comment. Not sure it makes sense to use The only formal description of
|
It looks like the idea has already been brought up and is already implemented in some fashion in at least Firefox and Chrome, but it would be nice if there was some spec guarantee on guarding async operations with a timeout, and some way to customize behavior.
In theory, it's not hard to create a service worker than can never be removed, by creating some aysnc operation that can never finish:
A few ideas for public APIs to prevent these issues and provide fine-grain control:
Additional timeout param for
waitUntil
/respondWith
API for adding a default timeout for functional events
Not quite sure where this could be done. Perhaps during worker registration? I feel like adding a worker specific option to
addEventListener
would be too intrusive.Allow installing worker to cutoff active worker
Specifically, allow
skipWaiting
to provide an “ultimatum” timeout to the active worker to finish any async operations.The text was updated successfully, but these errors were encountered: