Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/contra/ drwxrwxr-x | |
| Viewing file: Select action/file-type: 'use strict';
var atoa = require('atoa');
var a = require('./a');
var once = require('./once');
var emitter = require('./emitter');
var debounce = require('./debounce');
module.exports = function queue (worker, concurrency) {
var q = [], load = 0, max = concurrency || 1, paused;
var qq = emitter({
push: manipulate.bind(null, 'push'),
unshift: manipulate.bind(null, 'unshift'),
pause: function pause () { paused = true; },
resume: function resume () { paused = false; debounce(labor); },
pending: q
});
if (Object.defineProperty && !Object.definePropertyPartial) {
Object.defineProperty(qq, 'length', { get: function getter () { return q.length; } });
}
function manipulate (how, task, done) {
var tasks = a(task) ? task : [task];
tasks.forEach(function insert (t) { q[how]({ t: t, done: done }); });
debounce(labor);
}
function labor () {
if (paused || load >= max) { return; }
if (!q.length) { if (load === 0) { qq.emit('drain'); } return; }
load++;
var job = q.pop();
worker(job.t, once(complete.bind(null, job)));
debounce(labor);
}
function complete (job) {
load--;
debounce(job.done, atoa(arguments, 1));
debounce(labor);
}
return qq;
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0319 ]-- |