Эх сурвалжийг харах

[misc] creating a redis client with redis-sentinel opts throws an error

Jakob Ackermann 5 жил өмнө
parent
commit
e34f17a352

+ 6 - 0
libraries/redis-wrapper/index.js

@@ -26,6 +26,12 @@ function createClient(opts) {
     standardOpts.retry_max_delay = 5000 // ms
   }
 
+  if (standardOpts.endpoints) {
+    throw new Error(
+      '@overleaf/redis-wrapper: redis-sentinel is no longer supported'
+    )
+  }
+
   let client
   if (opts.cluster) {
     delete standardOpts.cluster

+ 14 - 0
libraries/redis-wrapper/test/unit/src/test.js

@@ -55,6 +55,20 @@ describe('index', function () {
     return (this.auth_pass = '1234 pass')
   })
 
+  describe('redis-sentinel', function () {
+    it('should throw an error when creating a client', function () {
+      const redisSentinelOptions = {
+        endpoints: ['127.0.0.1:1234', '127.0.0.1:2345', '127.0.0.1:3456'],
+      }
+      const createNewClient = () => {
+        this.redis.createClient(redisSentinelOptions)
+      }
+      expect(createNewClient).to.throw(
+        '@overleaf/redis-wrapper: redis-sentinel is no longer supported'
+      )
+    })
+  })
+
   describe('single node redis', function () {
     beforeEach(function () {
       return (this.standardOpts = {