コード例 #1
0
ファイル: socket.js プロジェクト: inProgress-team/BlueStormJS
        d.run(function() {
            if(process.env.NODE_ENV!='development') {
                io.adapter(redis({ host: appConfig.redis.getConfig().host, port: appConfig.redis.getConfig().port }));
            }

            io.on('connection', onConnect);
        });
コード例 #2
0
ファイル: redisConnector.js プロジェクト: Vips2340/nohm-admin
exports.quit = function () {
  registry.redis_sessions.quit();
  registry.redis.quit();
  registry.redis_pub.quit();
  registry.redis_sub.quit();
  nohm_redis_client.quit();
}
コード例 #3
0
ファイル: noop.js プロジェクト: gcoonrod/node-resque
 worker.on('success', async () => {
   expect(loggedErrors.length).toBe(1)
   let length = await specHelper.redis.llen('resque_test:failed')
   expect(length).toBe(0)
   await worker.end()
   resolve()
 })
コード例 #4
0
 beforeEach(function (done) {
   Queue = kue.createQueue({
     redis: {
       db: 2 // custom db
     }
   });
   redisPublishClient = kue.redis.createClient();
   done();
 });
コード例 #5
0
ファイル: queueLock.js プロジェクト: gcoonrod/node-resque
        async () => {
          const enqueue = await queue.enqueue(specHelper.queue, 'blockingJob', [1, 2])
          expect(enqueue).toBe(true)

          await worker.start()
          await worker.end()

          const result = await specHelper.redis.keys(specHelper.namespace + ':lock*')
          expect(result).toHaveLength(0)
        }
コード例 #6
0
ファイル: queueLock.js プロジェクト: gcoonrod/node-resque
      test('will remove a lock on a job when the job has been worked', async () => {
        const enqueue = await queue.enqueue(specHelper.queue, 'uniqueJob', [1, 2])
        expect(enqueue).toBe(true)

        await worker.start()
        await worker.end()

        const result = await specHelper.redis.keys(specHelper.namespace + ':lock*')
        expect(result).toHaveLength(0)
      })
コード例 #7
0
ファイル: scheduler.js プロジェクト: gcoonrod/node-resque
            scheduler.on('cleanStuckWorker', async (workerName, errorPayload, delta) => {
              // response data should contain failure
              expect(workerName).toEqual(worker.name)
              expect(errorPayload.worker).toEqual(worker.name)
              expect(errorPayload.error).toEqual('Worker Timeout (killed manually)')

              // check the workers list, should be empty now
              expect(await queue.allWorkingOn()).toEqual({})

              // check the failed list
              let failed = await specHelper.redis.rpop(specHelper.namespace + ':' + 'failed')
              failed = JSON.parse(failed)
              expect(failed.queue).toBe('stuckJobs')
              expect(failed.exception).toBe('Worker Timeout (killed manually)')
              expect(failed.error).toBe('Worker Timeout (killed manually)')

              scheduler.removeAllListeners('cleanStuckWorker')
              resolve()
            })
コード例 #8
0
ファイル: tvdbModel.js プロジェクト: maritz/seenit
 self._tvdbRequest('/GetSeries.php?seriesname='+encodeURIComponent(name), function (err, doc) {
   if (err) {
     callback(err);
   } else {
     var multi = redis.multi();
     var arr = doc.find('//Series').map(function (serie) {
       var values = {
         name: getText(serie.get('SeriesName')),
         description: getText(serie.get('Overview')),
         id: getText(serie.get('seriesid')),
         first_aired: getText(serie.get('FirstAired'))
       };
       multi.rpush(set_key, JSON.stringify(values));
       return values;
     });
     multi.expire(set_key, 60*60); // expire in one hour
     multi.exec();
     callback(null, arr);
   }
 });
コード例 #9
0
ファイル: tvdbModel.js プロジェクト: maritz/seenit
 searchSeries: function (name, callback) {
   var self = this;
   var set_key = 'temp_tvdb_cache:getseries:'+name;
   var redis = require(__dirname+'/../registry.js').redis;
   redis.lrange(set_key, 0, -1, function (err, series) {
     if (err || series.length === 0) {
       self._tvdbRequest('/GetSeries.php?seriesname='+encodeURIComponent(name), function (err, doc) {
         if (err) {
           callback(err);
         } else {
           var multi = redis.multi();
           var arr = doc.find('//Series').map(function (serie) {
             var values = {
               name: getText(serie.get('SeriesName')),
               description: getText(serie.get('Overview')),
               id: getText(serie.get('seriesid')),
               first_aired: getText(serie.get('FirstAired'))
             };
             multi.rpush(set_key, JSON.stringify(values));
             return values;
           });
           multi.expire(set_key, 60*60); // expire in one hour
           multi.exec();
           callback(null, arr);
         }
       });
     } else {
       callback(null, series.map(function (item) {
         try {
           return JSON.parse(item);
         } catch (e) {
         }
       }));
     }
   });
 }, 
コード例 #10
0
ファイル: connection.js プロジェクト: gcoonrod/node-resque
 test('should stat with no redis keys in the namespace', async () => {
   let keys = await specHelper.redis.keys(specHelper.namespace + '*')
   expect(keys.length).toBe(0)
 })
コード例 #11
0
ファイル: user.model.js プロジェクト: tvrc4m/nodeJS
function UserRedis(){
	model.redis.call(this);
};
コード例 #12
0
ファイル: socket.js プロジェクト: inProgress-team/BlueStormJS
 d.run(function() {
     io.adapter(redis({ host: appConfig.redis.getConfig().host, port: appConfig.redis.getConfig().port }));
     io.on('connection', onConnect);
 });
コード例 #13
0
ファイル: child.js プロジェクト: CowLeo/nohm
var redis = require('redis');
var nohm = require(__dirname+'/../../lib/nohm').Nohm;
var args = require(__dirname+'/../testArgs.js');

nohm.setPrefix(args.prefix);
args.redis.on('ready', function () {
  nohm.setClient(args.redis);
});
require(__dirname+'/Model.js');

process.on('message', function (msg) {
  var event, modelName, fn;
  
  switch (msg.question) {
    case 'does nohm have pubsub?':
      process.send({
        question: msg.question,
        answer: nohm.getPubSubClient()
      });
    break;
    
    case 'initialize':
      nohm.setPubSubClient(redis.createClient(args.redis_port, args.redis_host), function (err) {
        process.send({
          question: msg.question,
          answer: err || true,
          error: err
        });
      });
    break;
    
コード例 #14
0
ファイル: seo.js プロジェクト: inProgress-team/BlueStormJS
client.on("error", function (err) {
    console.error("Error connecting redis ("+appConfig.redis.getConfig().host+" port "+appConfig.redis.getConfig().port+")");
});
コード例 #15
0
ファイル: seo.js プロジェクト: inProgress-team/BlueStormJS
var phridge = require('phridge'),
    redis = require("redis");

var TTL_CACHE_SEO = 60 * 60 * 24; //1 day

var htmlcleaner = require(__dirname+'/htmlcleaner'),
    status = require(__dirname+'/status'),
    appConfig = require(__dirname+'/../../config');//,
    //translateSeo = require(__dirname+'/translate-seo');

var client = redis.createClient(appConfig.redis.getConfig().port, appConfig.redis.getConfig().host);
client.on("error", function (err) {
    console.error("Error connecting redis ("+appConfig.redis.getConfig().host+" port "+appConfig.redis.getConfig().port+")");
});

var bots = [
    //FACEBOOK
    'facebookexternalhit/1.http (+0://www.facebook.com/externalhit_uatext.php)',
    'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)',
    'Facebot',

    //SLACK
    'Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)',
    'Slack-ImgProxy 0.19 (+https://api.slack.com/robots)',
    'Slackbot 1.0(+https://api.slack.com/robots)',

    //TWITTER
    'Twitterbot/1.0',

    //PINTEREST
    'Pinterest/0.1 +http://pinterest.com/',
コード例 #16
0
ファイル: redisConnector.js プロジェクト: Vips2340/nohm-admin
exports.connect = function (cb) {
  
  nohm_redis_client = redis.createClient(config.nohm.port, config.nohm.host, { no_ready_check: true });
  nohm_redis_client.on('error', function () {
    console.log('nohm redis error: ', arguments);
  });
  
  registry.redis_sessions = redis.createClient(config.redis.port, config.redis.host, { no_ready_check: true });
  registry.redis_sessions.on('error', function () {
    console.log('redis error: ', arguments);
  });
  
  registry.redis = redis.createClient(config.redis.port, config.redis.host, { no_ready_check: true });
  registry.redis.on('error', function () {
    console.log('redis error: ', arguments);
  });
  registry.redis_pub = redis.createClient(config.redis.port, config.redis.host, { no_ready_check: true });
  registry.redis_pub.on('error', function () {
    console.log('redis error: ', arguments);
  });
  registry.redis_sub = redis.createClient(config.redis.port, config.redis.host, { no_ready_check: true });
  registry.redis_sub.on('error', function () {
    console.log('redis error: ', arguments);
  });
  
  var noop = function () {};
  
  var authAndSelect = function (client, db, pw) {
    return function (cb) {
      if (pw) {
        client.auth(pw, function (err) {
          if (err) {
            cb(err)
          } else {
            client.select(db || 0, cb);
          }
          cb = noop;
        });
      } else {
        client.select(db || 0, cb);
        cb = noop;
      }
    }
  }
  
  async.series([
    authAndSelect(registry.redis_sessions, config.sessions.db, config.redis.pw),
    authAndSelect(registry.redis, config.redis.db, config.redis.pw),
    authAndSelect(registry.redis_pub, config.redis.db, config.redis.pw),
    authAndSelect(registry.redis_sub, config.redis.db, config.redis.pw),
    authAndSelect(nohm_redis_client, config.nohm.db, config.nohm.pw)
    ],
    function (err) {
      if (err) {
        return console.log('Error: failed initialization while authing/selecting a redis DB ', err);
      }
      
      nohm.setClient(nohm_redis_client);
      nohm.setPrefix(config.nohm.prefix);
      
      cb();
    }
  );
  
};