不要怂,就是干,撸起袖子干!

Commit d1ec689e by Mick Hansen

Merge pull request #5487 from substantial/use-each-rather-than-map-when-truncating

Execute promises sequentially rather than parallel
2 parents d579e823 5766526b
Showing with 8 additions and 2 deletions
...@@ -1009,9 +1009,15 @@ Sequelize.prototype.truncate = function(options) { ...@@ -1009,9 +1009,15 @@ Sequelize.prototype.truncate = function(options) {
} }
}, { reverse: false }); }, { reverse: false });
return Promise.map(models, function(model) { var truncateModel = function(model) {
return model.truncate(options); return model.truncate(options);
}); };
if (options && options.cascade) {
return Promise.each(models, truncateModel);
} else {
return Promise.map(models, truncateModel);
}
}; };
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!