Permalink
Browse files

Make the dMap not grow stack and tick friendly

  • Loading branch information...
1 parent 75c7e29 commit fc1b1e996026d6547847a1a5bc54986dede3bbe5 @temas temas committed Mar 18, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/dMap.js
View
@@ -187,7 +187,7 @@ exports.types = function (type, profiles) {
// run a specific service pumps, usually last
exports.pump = function (cset, callback) {
- cset.forEach(function (entry) {
+ async.forEachSeries(cset, function (entry, cbStep) {
var r = idr.parse(entry.idr);
var svc = maps[r.host] || maps.system;
if (!svc.pumps) return;
@@ -196,8 +196,10 @@ exports.pump = function (cset, callback) {
if (!svc.pumps[name][r.protocol]) return;
svc.pumps[name][r.protocol](entry);
});
+ process.nextTick(cbStep);
+ }, function(err) {
+ callback(null, cset);
});
- callback(null, cset);
};
// return the integer code for the given string type services start at 100, to

0 comments on commit fc1b1e9

Please sign in to comment.