Re: [push-api] Multiple consecutive messages (#168)

I don't think that it can ever truly be parallel.  After all, Javascript is run-to-completion.  I'm not suggesting that we let the waitUntil promise on the first run, just that in the synchronous processing you have no opportunity to learn of what comes next.

Even if multiple events will be delivered into the event loop at the same time, you can't do anything to learn about what is pending until you complete the synchronous (and Promise-based) processing of the first event.

You can't even collect messages by adding a callback to the end of the event loop without some pretty ugly haxx. Promises only generate microtasks and get executed ahead of the next event in the loop. Fetch or some other asynchronous API might work for that purpose, though I'm not sure that postMessage to self works due to various optimizations that are used.

I don't think that forcing sites to use hacks here is the right answer.

Collapsing only helps in the case that the messages are not able to be delivered.  Once the message has been delivered to the next stage of the pipeline, it can't be recalled.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/168#issuecomment-148455980

Received on Thursday, 15 October 2015 16:58:09 UTC