mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 02:41:09 +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?
|
if !opts.retry_max_delay?
|
||||||
opts.retry_max_delay = 5000 # ms
|
opts.retry_max_delay = 5000 # ms
|
||||||
|
|
||||||
if opts.endpoints?
|
if opts.cluster?
|
||||||
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?
|
|
||||||
Redis = require("ioredis")
|
Redis = require("ioredis")
|
||||||
standardOpts = _.clone(opts)
|
standardOpts = _.clone(opts)
|
||||||
delete standardOpts.cluster
|
delete standardOpts.cluster
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
"async": "^2.5.0",
|
"async": "^2.5.0",
|
||||||
"coffee-script": "1.8.0",
|
"coffee-script": "1.8.0",
|
||||||
"ioredis": "~4.17.3",
|
"ioredis": "~4.17.3",
|
||||||
"redis-sentinel": "0.1.1",
|
|
||||||
"underscore": "1.7.0"
|
"underscore": "1.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -11,16 +11,11 @@ describe "index", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
||||||
@settings = {}
|
@settings = {}
|
||||||
@sentinelClient =
|
|
||||||
set: ->
|
|
||||||
on: ->
|
|
||||||
@normalRedisClient =
|
@normalRedisClient =
|
||||||
get: ->
|
get: ->
|
||||||
on: ->
|
on: ->
|
||||||
@ioredisConstructor = ioredisConstructor = sinon.stub()
|
@ioredisConstructor = ioredisConstructor = sinon.stub()
|
||||||
|
|
||||||
@sentinel =
|
|
||||||
createClient: sinon.stub().returns(@sentinelClient)
|
|
||||||
@normalRedis =
|
@normalRedis =
|
||||||
createClient: sinon.stub().returns(@normalRedisClient)
|
createClient: sinon.stub().returns(@normalRedisClient)
|
||||||
@ioredis = class IoRedis
|
@ioredis = class IoRedis
|
||||||
|
@ -30,33 +25,9 @@ describe "index", ->
|
||||||
constructor: (@config, @options) ->
|
constructor: (@config, @options) ->
|
||||||
on: sinon.stub()
|
on: sinon.stub()
|
||||||
@redis = SandboxedModule.require modulePath, requires:
|
@redis = SandboxedModule.require modulePath, requires:
|
||||||
"redis-sentinel":@sentinel
|
|
||||||
"redis":@normalRedis
|
"redis":@normalRedis
|
||||||
"ioredis": @ioredis
|
"ioredis": @ioredis
|
||||||
@auth_pass = "1234 pass"
|
@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", ->
|
describe "single node redis", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -67,7 +38,6 @@ describe "index", ->
|
||||||
|
|
||||||
it "should use the ioredis driver in single-instance mode if a non array is passed", ->
|
it "should use the ioredis driver in single-instance mode if a non array is passed", ->
|
||||||
client = @redis.createClient @standardOpts
|
client = @redis.createClient @standardOpts
|
||||||
@sentinel.createClient.called.should.equal false
|
|
||||||
@normalRedis.createClient.called.should.equal false
|
@normalRedis.createClient.called.should.equal false
|
||||||
assert.equal(client.constructor, @ioredis)
|
assert.equal(client.constructor, @ioredis)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue