mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-22 23:01:44 +00:00
[misc] drop support for redis-sentinel
This commit is contained in:
parent
aa16e48321
commit
90ad28c51c
3 changed files with 1 additions and 38 deletions
|
@ -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
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue