setImmediate

David Bruant bruant.d at gmail.com
Thu Aug 8 11:03:42 PDT 2013


Le 08/08/2013 17:00, Domenic Denicola a écrit :
> Hmm, interesting!
>
> I wonder if it could be event simpler than that, and after an arbitrary limit (in time, not number of microtasks), just reschedule for the next event loop turn's microtask phase. For promise applications there is no problem with this; I am not sure however if that is an entirely representative use case. You could definitely imagine some invariants being broken. I guess that's why you have a `'toolong'` event
Exactly.

> although I am skeptical that users of microtasks will have the knowledge of what to do in order to uphold their invariants in the rare case of being preempted.
Exactly like with a script stuck in a while loop of sort (for which, we 
don't even have a callback to repair things. Maybe an extension to 
functions could allow this sort of mechanism for normal function calls).
For the vast majority of the code I have written, I think I count myself 
in the category of those who do not know how their code is broken by the 
"script too long" dialog.
As you say, it should be a rare case (as rare as the slow script dialog 
nowadays, I imagine)

David


More information about the es-discuss mailing list