Shinobi/libs/common.js

12 lines
369 B
JavaScript
Raw Normal View History

2020-08-27 05:37:44 +00:00
const async = require("async");
2020-08-27 05:30:18 +00:00
exports.copyObject = (obj) => {
return Object.assign({},obj)
}
2020-08-27 05:37:44 +00:00
exports.createQueue = (timeoutInSeconds, queueItemsRunningInParallel) => {
return async.queue(function(action, callback) {
setTimeout(function(){
action(callback)
2020-08-27 05:40:57 +00:00
},timeoutInSeconds * 1000 || 1000)
2020-08-27 05:37:44 +00:00
},queueItemsRunningInParallel || 3)
}