lib/jobqueue.js
function (job, config, callback) {
    var task = {
      job: job,
      config: config,
      callback: callback || function () {
      }
    };

    task.id = task.job._id;

    // Tasks with identical keys will be prevented from being scheduled concurrently.
    task.key = task.job.project + branchFromJob(task.job);

    this.tasks.push(task);

    // Defer task execution to the next event loop tick to ensure that the push() function's
    // callback is *always* invoked asynchronously.
    // http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
    process.nextTick(this.drain.bind(this));
  }
function (job, config, callback) {
    var task = {
      job: job,
      config: config,
      callback: callback || function () {
      }
    };

    task.id = task.job._id;

    // Tasks with identical keys will be prevented from being scheduled concurrently.
    task.key = task.job.project + branchFromJob(task.job);

    this.tasks.push(task);

    // Defer task execution to the next event loop tick to ensure that the push() function's
    // callback is *always* invoked asynchronously.
    // http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
    process.nextTick(this.drain.bind(this));
  }
function ( job , config , callback ) { var task = { job : job , config : config , callback : callback || function ( ) { } } ; task . id = task . job . _id ; // Tasks with identical keys will be prevented from being scheduled concurrently. task . key = task . job . project + branchFromJob ( task . job ) ; this . tasks . push ( task ) ; // Defer task execution to the next event loop tick to ensure that the push() function's // callback is *always* invoked asynchronously. // http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony process . nextTick ( this . drain . bind ( this ) ) ; }
Add a job to the end of the queue. If the queue is not currently saturated, immediately schedule a task to handle the new job. If a callback is provided, call it when this job's task completes.
Add a job to the end of the queue . If the queue is not currently saturated immediately schedule a task to handle the new job . If a callback is provided call it when this job s task completes .