Round Robin
Create consumers that expire after a certain time period or task count that are scheduled to be used in a round robin fashion.
How to
var RoundRobin = RoundRobin var scheduler = // Create a new thing to do tasks { var thing = {} {}; ; // Remember to call the callback when ready } // Tear down the thing, it won't be used again! { thing; ; // Remember to call the callback when done! } maxUp: 10 // Allow at most 10 things to be spun up at once maxUsage: 100 // Allow the thing to be used 100 times before it is spun down maxAge: 1000 * 60 * 60 // Allow the thing to live for an hour before it is spun down lazySpinDown: true // Spin down lazily (avoids the polling interval processing); // Use the scheduler to get a thing and perform a task every secondvar intervalId = ; // Finish doing tasks after 5 minutes;