Exemple #1
0
    function getContext(cb) {
      if(!config.store.token) {
        cb(new Error('InvalidCredentials'));
        return;
      }

      mixpanel.identify(config.store.userId);

      if(popup) {
        mixpanel.people.set({
          'lastContext': new Date(),
        });
        mixpanel.people.increment({
          'ContextCount': 1
        });
      }
      else {
        mixpanel.people.set({
          'lastInjectedContext': new Date(),
        });
        mixpanel.people.increment({
          'InjectedContextCount': 1
        });
      }

      chrome.runtime.sendMessage({
        type: 'anyfetch::backgroundFindContext',
      }, rarity.pad([null], cb));
    },
Exemple #2
0
    function filterStuckJobs(jobIds, jobs, cb) {
      jobs.forEach(function(job, index) {
        if(!job) {
          jobs[index] = {
            id: parseInt(jobIds[index])
          };
        }
      });

      async.filter(jobs || [], function(job, cb) {
        // After 24h, a job is considered to be stucked
        cb(!job.lastUpdate || Date.now() - job.lastUpdate > 24 * 3600 * 1000);
      }, rarity.pad([null], cb));
    },