- When does chrome considers serviceWorker is idle? Is it when the callback queue is empty? What happens If I have multiple fetch requests that are still processing but not yet finished? Will chrome stops the serviceWorker at that time?
service worker documentation is clear that termination can occur at almost any time
- If serviceWorker termination can happen at anytime, will it be applicable to sync event?
Regards,Hari krishna, DevHARI KRISHNA KDeveloperThoughtWorksOn Sat, Sep 17, 2016 at 7:59 PM, Matt Falkenhagen <fal...@chromium.org> wrote:Good find. Filed a bug: https://bugs.chromium.org/p/chromium/issues/detail?id=647943In the current implementation a simple timeout mechanism terminates service workers that have been idle for some time. It's not too difficult to circumvent and we expect to this design to evolve; service worker documentation is clear that termination can occur at almost any time. However keeping a SW alive due to repeated self-postmessaging seems particularly bad.2016-09-16 4:23 GMT+09:00 Hari krishna <harry....@gmail.com>:--
+chromium-dev---------- Forwarded message ---------
From: Hari krishna <harry....@gmail.com>
Date: Wed, Sep 14, 2016, 4:43 PM
Subject: [chromium-discuss] serviceWorker continues running if there is self spawning message event
To: Chromium-discuss <chromium...@chromium.org>Hi there,--We have been playing around serviceWorker functionalities. What we did is, we created a message event handler, that spawns another message event for every minute.Example code shown below.
self.addEventListener('message', function (event) {
var spawnNewMessageEvent = function (data) {
return new Promise(function (success) {
setTimeout(function () {
var sw = self.registration.active;
sw.postMessage(data);
success("success");
}, 30000)
});
};
event.waitUntil(doSomething().then(spawnNewMessageEvent));
});The above code snippet makes serviceWorker to keep running in the background. And we know that this is something message events shouldn't be used for. Just want to reach out the community, is it the intended behavior or kind of bug in serviceWorker? If it is intended behavior, it would be very helpful if you share the primary reason for developing this behavior (like some use cases or design decisions or tech debt)?Thanks,Hari krishna
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+unsubscribe@chromium.org.
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.