How to use the queue function from async
Find comprehensive JavaScript async.queue code examples handpicked from public code repositorys.
GitHub: qooxdoo/qooxdoo
220 221 222 223 224 225 226 227 228 229
this.__externals = []; this.__commonjsModules = {}; this.__taskQueueDrains = []; this.__taskQueue = async.queue(function (task, cb) { task(cb); }); this.__taskQueue.drain = this._onTaskQueueDrain; this.__taskQueue.error = err => {
257
758
0
131 132 133 134 135 136 137 138 139
} ], cb); } var q = async.queue(worker, 1); q.drain = callbackWrapper.wrapCallback(callback); q.push({ collection: page }); }
44
0
2
+ 3 other calls in file
GitHub: yetzt/node-scrapyard
41 42 43 44 45 46 47 48 49 50
// cache self.config.cache = (config.hasOwnProperty("cache") && (typeof config.cache) === 'string' && config.cache !== "") ? path.resolve(config.cache) : false; self.storage = (self.config.cache) ? new garage(self.config.cache) : false; // async queue witha concurrent conenctions self.queue = async.queue(function(fn, next){ fn(next); },self.config.connections); // fun with function objects, maintain old interface #legacy var bloogie = function(options, fn){ return self.scrape(options, fn); }; bloogie.scrape = function(options, fn){ return self.scrape(options, fn); };
9
10
4
+ 2 other calls in file
152 153 154 155 156 157 158 159 160 161
this.queueSkipMatch = this.config.get('http_queue_skip_uri_match') ? new RegExp( this.config.get('http_queue_skip_uri_match') ) : false; // if both max concurrent req AND max connections are not set, just use a very large number this.queue = async.queue( this.parseHTTPRequest.bind(this), this.maxConcurrentReqs || 8192 ); // front-end https header detection var ssl_headers = this.config.get('https_header_detect'); if (ssl_headers) {
2
7
0
160 161 162 163 164 165 166 167 168 169
throw err } return result } const q = async.queue(applyManifestExec, applyConcurrencyLimit) const applyManifest = async (manifest) => q.pushAsync(manifest) const deps = getDeps(manifests, options, context)
0
7
6
5 6 7 8 9 10 11 12 13 14 15
let dateOfLastAuditUpdate = new Date(2018, 0, 1); const userStats = []; const readUserStatsFromStore = async () => { return new Promise((resolve, reject) => { const q = queue(async (key) => { const hash = await redis.hgetall(key); const user = { userId: hash.userId, lastLogin: hash.lastLogin > 0 ? new Date(parseInt(hash.lastLogin)) : undefined,
1
2
10
+ 3 other calls in file
GitHub: abliss/tacro
147 148 149 150 151 152 153 154 155 156
// 0 .. highest var number seen var maxVar = []; // terms seen in this context var myTerms = {}; var usedSkinNames = {}; var queue = Async.queue(function(task, cb) { while (usedSkinNames[task.Skin.Name]) { task.Skin.Name +='_'; } usedSkinNames[task.Skin.Name] = true;
1
1
3
979 980 981 982 983 984 985 986 987 988
* } * ], callback); * * // es2017 example, though `asyncify` is not needed if your JS environment * // supports async functions out of the box * var q = async.queue(async.asyncify(async function(file) { * var intermediateStep = await processFile(file); * return await somePromise(intermediateStep) * })); *
0
2
1
+ 3 other calls in file
179 180 181 182 183 184 185 186 187 188 189 190
console.log("找到对象"); return thisJSON.data; }; let writeQueue = async.queue(({ path_way, thisJSONStr }, callBack) => { fs.writeFileSync(path_way, thisJSONStr); callBack(null, writeQueue.length()); }, 1);
0
1
1
GitHub: davidmerfield/Blot
283 284 285 286 287 288 289 290 291 292 293
function watch(directory) { // Stop the process from exiting automatically process.stdin.resume(); debug("Watching", directory, "for changes..."); var queue = async.queue(function (directory, callback) { build(directory, function (err) { if (err) { console.error(err.message); }
69
0
23
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
async.setImmediate(q.process); }); } // Start with a normal queue var q = async.queue(worker, concurrency); // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback);
0
0
0
+ 13 other calls in file
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002
async.setImmediate(q.process); }); } // Start with a normal queue const q = async.queue(worker, concurrency); // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback);
0
0
2
+ 14 other calls in file
15 16 17 18 19 20 21 22 23 24 25 26
console.log(`wallet address = ${wallet.address}`); let donations = []; // create payout queue const q = async.queue((task, callback) => { console.log(`donating to ${task.address}`); donate(task.address, (err, txHash) => { if (err) { console.log(`err: ${err}`);
0
0
1
GitHub: doudou886/nodejs-learn
753 754 755 756 757 758 759 760 761 762 763 764 765
Node.prototype.setFilters = function() { var self = this; this._latestQueue = async.queue(function (hash, callback) { var timeString = 'Got block ' + chalk.reset.red(hash) + chalk.reset.bold.white(' in') + chalk.reset.green(''); console.time('==>', timeString);
0
0
1
GitHub: letdagithub/module
49 50 51 52 53 54 55 56 57 58
this._fsEntriesProcessedBytes = 0; this._queue = async.queue(this._onQueueTask.bind(this), 1); this._queue.drain = this._onQueueDrain.bind(this); this._statQueue = async.queue(this._onStatQueueTask.bind(this), options.statConcurrency); this._state = { aborted: false, finalize: false,
0
0
0
async.parallel is the most popular function in async (1226 examples)