block by micahstubbs 87deae68fcab3f70d727401a89ff51a8

Infinite Queue Experiment

Full Screen

A little demo of an infinitely long-living queue with 24 parallel slots for tasks. The sentinel task that never invokes the callback prevents the queue from ending, even if there are not any currently-active tasks.

There is a downside to this approach, however, which is that the queue’s internal task results array increases in length by one with each task, even though in this case the queue’s results are never triggered. Thus, be careful using this pattern if you really expect the queue to live indefinitely. Alternatively, it might be worth extending Queue’s minimal API to allow tasks to be processed without tracking their return value.

forked from mbostock‘s block: Infinite Queue

index.html