If you pass in a function to a Limit, if there's space in the queue it runs the function synchronously. If there isn't, of course it runs later. This makes the performance characteristics of enqueuing unpredictable, and results in state sometimes changing before the next line of code, and sometimes not. (My team affectionately refers to the set of subtle bugs that this "sometimes-sync-sometimes-async" behavior can call as "zalgo".) It would be nice if enquing always deferred the enqueued function at least until the next tick.
If you pass in a function to a
Limit
, if there's space in the queue it runs the function synchronously. If there isn't, of course it runs later. This makes the performance characteristics of enqueuing unpredictable, and results in state sometimes changing before the next line of code, and sometimes not. (My team affectionately refers to the set of subtle bugs that this "sometimes-sync-sometimes-async" behavior can call as "zalgo".) It would be nice if enquing always deferred the enqueued function at least until the next tick.