Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

push-ioredis

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

push-ioredis - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

5

lib/clientProxy2.js

@@ -1,2 +0,1 @@

var Consts = require('./consts');
var crc = require('redis-crc');

@@ -296,3 +295,3 @@ var async = require('async');

var redisName = this.$redisClusterMap.getRedisName(value, env);
var redisName = this.$redisClusterMap.getRedisName(value);
console.log('in getClientByKey2, key = ' + key + ', redisName = ' + redisName);

@@ -315,3 +314,3 @@

var redisName = this.$redisClusterMap.getRedisName(value, env);
var redisName = this.$redisClusterMap.getRedisName(value);

@@ -318,0 +317,0 @@ return redisName;

9

lib/redis-failover.js

@@ -13,4 +13,4 @@ var Redis = require('ioredis');

var RedisFailover = function(configFilePath, redisShardingPath, env, clusterMapPath) {
this.env = env;
var RedisFailover = function(configFilePath, redisShardingPath, clusterMapPath) {
EventEmitter.call(this);
this.redisSharding = require(redisShardingPath);

@@ -67,6 +67,6 @@ this.clusterMapPath = clusterMapPath;

//util.inherits(redisProxy, EventEmitter);
util.inherits(RedisFailover, EventEmitter);
RedisFailover.prototype.createClient = function() {
var sharding = this.redisSharding[this.env];
var sharding = this.redisSharding;
//var redisFailover = new RedisFailover();

@@ -83,2 +83,3 @@ //redisFailover.createClient('../config/redisConfig.json');

this.emit('ready');
return redisProxy;

@@ -85,0 +86,0 @@ }

var RedisClusterMap = function(loadpath) {
this.$id = "redisClusterMap";
this.clusterEnvMap = {};
this.clusterNodesMap = {};
this.clusterNodes = [];
this.loadpath = loadpath;
}
RedisClusterMap.prototype.getClusterMap = function(env) {
var clusterMap = this.clusterEnvMap[env];
if (!clusterMap) {
var clusterLoadPath = this.loadpath || ('../config/' + env + '/clusterMap.json');
clusterMap = require(clusterLoadPath);
this.loadClusterNodes(clusterMap);
this.clusterEnvMap[env] = clusterMap;
}
RedisClusterMap.prototype.getClusterMap = function() {
var clusterMap = require(this.loadpath);
return clusterMap;
}
RedisClusterMap.prototype.getRedisName = function(vnodeId, env) {
var clusterMap = this.getClusterMap(env);
RedisClusterMap.prototype.getRedisName = function(vnodeId) {
var clusterMap = this.getClusterMap();

@@ -30,17 +19,2 @@ if (clusterMap[vnodeId]) {

RedisClusterMap.prototype.getClusterNodes = function() {
return this.clusterNodes;
}
RedisClusterMap.prototype.loadClusterNodes = function(clusterMap) {
for (var i = 0; i < clusterMap.length; i++) {
var item = clusterMap[i];
var name = item['name'];
if (!this.clusterNodesMap[name]) {
this.clusterNodesMap[name] = true;
this.clusterNodes.push(name);
}
}
}
module.exports = RedisClusterMap;
{
"name": "push-ioredis",
"version": "1.0.6",
"version": "1.0.7",
"description": "use sentinel + ioredis + sharding logic to replace push-redis-failover",

@@ -5,0 +5,0 @@ "main": "redisClient.js",

@@ -7,2 +7,4 @@ push-ioredis

NOTE THAT THE LIBRARY IS NOT INDEPENDENT.
---

@@ -9,0 +11,0 @@

@@ -12,6 +12,5 @@ var crypto = require('crypto');

var redisShardingPath = '../config/redisSharding.json';
var env = 'drill';
var clusterMapPath = '../config/drill/clusterMap.json';
//var redisFailover = new RedisFailover(redisConfigPath, redisShardingPath, env, clusterMapPath);
var redisFailover = new RedisFailover(redisConfigPath, redisShardingPath, env, null);
var redisFailover = new RedisFailover(redisConfigPath, redisShardingPath, clusterMapPath);
var failover = redisFailover.createClient();

@@ -18,0 +17,0 @@

@@ -9,5 +9,5 @@ var RedisFailover = require('../lib/redis-failover');

var redisShardingPath = '../config/redisSharding.json';
var env = 'drill';
//var env = 'drill';
var clusterMapPath = '../config/drill/clusterMap.json';
var redisFailover = new RedisFailover(redisConfigPath, redisShardingPath, env, clusterMapPath);
var redisFailover = new RedisFailover(redisConfigPath, redisShardingPath, clusterMapPath);
var failover = redisFailover.createClient();

@@ -14,0 +14,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc