smooth

Smooth, throttle, queue async function parallel execution with a limitation.

Smooth.js

  • limitation - default 10
  • max_queue if the queue size big than max_queue, will show an warn message.
  • timeout in ms - default 5000ms
var limit = 5;
var smooth = require('smooth')(limit);

smooth a function

foo = smooth(foo);

smooth a method of class.

RedisClient.prototype.get = smooth(RedisClient.prototype.get);

smooth a method of object.

redisClient.get = smooth(redisClient.get)

Without smooth

async.map(keys, function(keycallback) {
  memcacheClient.get('ITEM_' + key, callback);
}, callback);

With smooth

async.map(keys, smooth(function(keycallback){
  memcacheClient.get('ITEM_' + key, callback);
}), callback);