Beispiel #1
0
 taskStore.getTasks(auth.pid, function(err, curtasks) {
   taskStore.reconcileTasks(curtasks, fixedfreq, service, force, auth,
     function(err, added) {
     if (err) return callback(err);
     // if there's new tasks, queue them up asap
     if (added) redis.sadd("next", auth.pid);
     callback();
   });
 });
Beispiel #2
0
exports.taskUpdate = function(auth, callback, force) {
  if (!auth.pid) {
    logger.warn("invalid auth, missing pid",auth);
    return process.nextTick(callback.bind(null, new Error("auth missing pid")));
  }
  var service = auth.pid.split('@')[1];
  if (!servezas.synclets(service)) {
    return process.nextTick(callback.bind(null, new Error("unknown service")));
  }

  taskStore.reconcileTasks(auth, force, function(err, added) {
    if (err) return callback(err);
    // if there's new tasks, queue them up asap
    if (added) redis.sadd("next", auth.pid);
    callback();
  });
};
exports.taskUpdate = function(auth, callback, force, batch) {
  if (!auth.pid) {
    logger.warn("invalid auth, missing pid",auth);
    return process.nextTick(callback.bind(null, new Error("auth missing pid")));
  }
  var service = auth.pid.split('@')[1];
  if (!servezas.synclets(service)) {
    return process.nextTick(callback.bind(null, new Error("unknown service")));
  }

  taskStore.reconcileTasks(auth, force, function(err, added) {
    if (err) return callback(err);
    // if there's new tasks, queue them up asap
    if (added) {
      queenBee.enqueue(auth.pid, (force || batch)?
        queenBee.STANDARD_QUEUE : queenBee.PRIORITY_QUEUE);
    }
    callback();
  });
};
Beispiel #4
0
  rclient.select(lconfig.worker.redis.database, function (err) {
    if (err) return cbDone(err);

    if (!auth.pid) {
      return process.nextTick(
        cbDone.bind(null, new Error("taskUpdate: auth missing pid")));
    }

    var profileId = lutil.parseProfileId(auth.pid);
    if (!servezas.synclets(profileId.service)) {
      return process.nextTick(
        cbDone.bind(null, new Error("taskUpdate: unknown service")));
    }

    taskStore.reconcileTasks(auth, force, function (err, added) {
      if (err) return cbDone(err);
      if (added) {
        logger.info("Scheduling " + auth.pid + " for immediate sync!");
        pcron.schedule(profileId.service, profileId.id, 0, false, cbDone);
      } else {
        cbDone();
      }
    });
  });