From 90ad28c51ccf451b39e09ba3618f9c1c7d808735 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 9 Nov 2020 12:37:33 +0000 Subject: [PATCH] [misc] drop support for redis-sentinel --- libraries/redis-wrapper/index.coffee | 8 +------- libraries/redis-wrapper/package.json | 1 - libraries/redis-wrapper/test.coffee | 30 ---------------------------- 3 files changed, 1 insertion(+), 38 deletions(-) diff --git a/libraries/redis-wrapper/index.coffee b/libraries/redis-wrapper/index.coffee index 05f5fa9fbb..bcb97d4657 100644 --- a/libraries/redis-wrapper/index.coffee +++ b/libraries/redis-wrapper/index.coffee @@ -14,13 +14,7 @@ module.exports = RedisSharelatex = if !opts.retry_max_delay? opts.retry_max_delay = 5000 # ms - if opts.endpoints? - standardOpts = _.clone(opts) - delete standardOpts.endpoints - delete standardOpts.masterName - client = require("redis-sentinel").createClient opts.endpoints, opts.masterName, standardOpts - client.healthCheck = RedisSharelatex.singleInstanceHealthCheckBuilder(client) - else if opts.cluster? + if opts.cluster? Redis = require("ioredis") standardOpts = _.clone(opts) delete standardOpts.cluster diff --git a/libraries/redis-wrapper/package.json b/libraries/redis-wrapper/package.json index 7af287fad8..2ae31da636 100644 --- a/libraries/redis-wrapper/package.json +++ b/libraries/redis-wrapper/package.json @@ -9,7 +9,6 @@ "async": "^2.5.0", "coffee-script": "1.8.0", "ioredis": "~4.17.3", - "redis-sentinel": "0.1.1", "underscore": "1.7.0" }, "devDependencies": { diff --git a/libraries/redis-wrapper/test.coffee b/libraries/redis-wrapper/test.coffee index ae74ee7aa9..83ccdb2703 100644 --- a/libraries/redis-wrapper/test.coffee +++ b/libraries/redis-wrapper/test.coffee @@ -11,16 +11,11 @@ describe "index", -> beforeEach -> @settings = {} - @sentinelClient = - set: -> - on: -> @normalRedisClient = get: -> on: -> @ioredisConstructor = ioredisConstructor = sinon.stub() - @sentinel = - createClient: sinon.stub().returns(@sentinelClient) @normalRedis = createClient: sinon.stub().returns(@normalRedisClient) @ioredis = class IoRedis @@ -30,33 +25,9 @@ describe "index", -> constructor: (@config, @options) -> on: sinon.stub() @redis = SandboxedModule.require modulePath, requires: - "redis-sentinel":@sentinel "redis":@normalRedis "ioredis": @ioredis @auth_pass = "1234 pass" - @endpoints = [ - {host: '127.0.0.1', port: 26379}, - {host: '127.0.0.1', port: 26380} - ] - - describe "sentinel", -> - beforeEach -> - @masterName = "my master" - @sentinelOptions = - endpoints:@endpoints - masterName:@masterName - auth_pass:@auth_pass - - it "should use sentinal if the first argument in an array", -> - client = @redis.createClient @sentinelOptions - @sentinel.createClient.called.should.equal true - @normalRedis.createClient.called.should.equal false - client.should.equal @sentinelClient - - it "should pass the options correctly though", -> - client = @redis.createClient @sentinelOptions - @sentinel.createClient.calledWith(@endpoints, @masterName, {auth_pass:@auth_pass, retry_max_delay: 5000}).should.equal true - client.should.equal @sentinelClient describe "single node redis", -> beforeEach -> @@ -67,7 +38,6 @@ describe "index", -> it "should use the ioredis driver in single-instance mode if a non array is passed", -> client = @redis.createClient @standardOpts - @sentinel.createClient.called.should.equal false @normalRedis.createClient.called.should.equal false assert.equal(client.constructor, @ioredis)