[misc] bump @overleaf/redis-wrapper to version 2.0.0

This commit is contained in:
Jakob Ackermann 2020-11-10 11:32:04 +00:00
parent 0e0c6c7293
commit 08ed5f6c9b
26 changed files with 185 additions and 220 deletions

View file

@ -110,7 +110,7 @@ app.get('/status', (req, res) => {
} }
}) })
const pubsubClient = require('redis-sharelatex').createClient( const pubsubClient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.pubsub Settings.redis.pubsub
) )
app.get('/health_check/redis', (req, res, next) => { app.get('/health_check/redis', (req, res, next) => {
@ -124,7 +124,7 @@ app.get('/health_check/redis', (req, res, next) => {
}) })
}) })
const docUpdaterRedisClient = require('redis-sharelatex').createClient( const docUpdaterRedisClient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
app.get('/health_check/redis_cluster', (req, res, next) => { app.get('/health_check/redis_cluster', (req, res, next) => {

View file

@ -18,7 +18,7 @@ let DispatchManager
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Keys = require('./UpdateKeys') const Keys = require('./UpdateKeys')
const redis = require('redis-sharelatex') const redis = require('@overleaf/redis-wrapper')
const Errors = require('./Errors') const Errors = require('./Errors')
const UpdateManager = require('./UpdateManager') const UpdateManager = require('./UpdateManager')

View file

@ -13,7 +13,9 @@
*/ */
let HistoryRedisManager let HistoryRedisManager
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclient = require('redis-sharelatex').createClient(Settings.redis.history) const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.history
)
const Keys = Settings.redis.history.key_schema const Keys = Settings.redis.history.key_schema
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')

View file

@ -14,7 +14,7 @@
let LockManager let LockManager
const metrics = require('./Metrics') const metrics = require('./Metrics')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const redis = require('redis-sharelatex') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(Settings.redis.lock) const rclient = redis.createClient(Settings.redis.lock)
const keys = Settings.redis.lock.key_schema const keys = Settings.redis.lock.key_schema
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')

View file

@ -19,7 +19,7 @@ const projectHistoryKeys = __guard__(
Settings.redis != null ? Settings.redis.project_history : undefined, Settings.redis != null ? Settings.redis.project_history : undefined,
(x) => x.key_schema (x) => x.key_schema
) )
const rclient = require('redis-sharelatex').createClient( const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.project_history Settings.redis.project_history
) )
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')

View file

@ -13,10 +13,10 @@
*/ */
let RealTimeRedisManager let RealTimeRedisManager
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclient = require('redis-sharelatex').createClient( const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
const pubsubClient = require('redis-sharelatex').createClient( const pubsubClient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.pubsub Settings.redis.pubsub
) )
const Keys = Settings.redis.documentupdater.key_schema const Keys = Settings.redis.documentupdater.key_schema

View file

@ -15,7 +15,7 @@
*/ */
let RedisManager let RedisManager
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclient = require('redis-sharelatex').createClient( const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')

View file

@ -1,5 +1,5 @@
Settings = require "settings-sharelatex" Settings = require "settings-sharelatex"
rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater) rclient = require("@overleaf/redis-wrapper").createClient(Settings.redis.documentupdater)
keys = Settings.redis.documentupdater.key_schema keys = Settings.redis.documentupdater.key_schema
async = require "async" async = require "async"
RedisManager = require "./app/js/RedisManager" RedisManager = require "./app/js/RedisManager"

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,8 @@
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write" "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
}, },
"dependencies": { "dependencies": {
"@overleaf/o-error": "^3.1.0",
"@overleaf/redis-wrapper": "^2.0.0",
"async": "^2.5.0", "async": "^2.5.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bunyan": "~0.22.1", "bunyan": "~0.22.1",
@ -26,7 +28,6 @@
"logger-sharelatex": "^1.9.1", "logger-sharelatex": "^1.9.1",
"metrics-sharelatex": "^2.6.2", "metrics-sharelatex": "^2.6.2",
"mongodb": "^3.6.0", "mongodb": "^3.6.0",
"redis-sharelatex": "^1.0.13",
"request": "^2.88.2", "request": "^2.88.2",
"requestretry": "^4.1.0", "requestretry": "^4.1.0",
"settings-sharelatex": "^1.1.0" "settings-sharelatex": "^1.1.0"

View file

@ -17,13 +17,13 @@ chai.should()
const { expect } = chai const { expect } = chai
const async = require('async') const async = require('async')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclient_history = require('redis-sharelatex').createClient( const rclient_history = require('@overleaf/redis-wrapper').createClient(
Settings.redis.history Settings.redis.history
) // note: this is track changes, not project-history ) // note: this is track changes, not project-history
const rclient_project_history = require('redis-sharelatex').createClient( const rclient_project_history = require('@overleaf/redis-wrapper').createClient(
Settings.redis.project_history Settings.redis.project_history
) )
const rclient_du = require('redis-sharelatex').createClient( const rclient_du = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
const Keys = Settings.redis.documentupdater.key_schema const Keys = Settings.redis.documentupdater.key_schema

View file

@ -2,7 +2,7 @@ const sinon = require('sinon')
const chai = require('chai') const chai = require('chai')
chai.should() chai.should()
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclientProjectHistory = require('redis-sharelatex').createClient( const rclientProjectHistory = require('@overleaf/redis-wrapper').createClient(
Settings.redis.project_history Settings.redis.project_history
) )
const ProjectHistoryKeys = Settings.redis.project_history.key_schema const ProjectHistoryKeys = Settings.redis.project_history.key_schema

View file

@ -3,7 +3,7 @@ const chai = require('chai')
chai.should() chai.should()
const { expect } = require('chai') const { expect } = require('chai')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const docUpdaterRedis = require('redis-sharelatex').createClient( const docUpdaterRedis = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
const Keys = Settings.redis.documentupdater.key_schema const Keys = Settings.redis.documentupdater.key_schema

View file

@ -1,13 +1,13 @@
let DocUpdaterClient let DocUpdaterClient
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const rclient = require('redis-sharelatex').createClient( const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.documentupdater Settings.redis.documentupdater
) )
const keys = Settings.redis.documentupdater.key_schema const keys = Settings.redis.documentupdater.key_schema
const request = require('request').defaults({ jar: false }) const request = require('request').defaults({ jar: false })
const async = require('async') const async = require('async')
const rclientSub = require('redis-sharelatex').createClient( const rclientSub = require('@overleaf/redis-wrapper').createClient(
Settings.redis.pubsub Settings.redis.pubsub
) )
rclientSub.subscribe('applied-ops') rclientSub.subscribe('applied-ops')

View file

@ -1,4 +1,4 @@
redis = require "redis-sharelatex" redis = require "@overleaf/redis-wrapper"
rclient1 = redis.createClient(cluster: [{ rclient1 = redis.createClient(cluster: [{
port: "7000" port: "7000"
host: "localhost" host: "localhost"

View file

@ -1,4 +1,4 @@
redis = require "redis-sharelatex" redis = require "@overleaf/redis-wrapper"
rclient1 = redis.createClient(cluster: [{ rclient1 = redis.createClient(cluster: [{
port: "7000" port: "7000"
host: "localhost" host: "localhost"

View file

@ -35,7 +35,7 @@ describe('DispatchManager', function () {
documentupdater: {} documentupdater: {}
} }
}), }),
'redis-sharelatex': (this.redis = {}), '@overleaf/redis-wrapper': (this.redis = {}),
'./RateLimitManager': {}, './RateLimitManager': {},
'./Errors': Errors, './Errors': Errors,
'./Metrics': (this.Metrics = { './Metrics': (this.Metrics = {

View file

@ -27,7 +27,7 @@ describe('HistoryRedisManager', function () {
this.rclient.multi = () => this.rclient this.rclient.multi = () => this.rclient
this.HistoryRedisManager = SandboxedModule.require(modulePath, { this.HistoryRedisManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'redis-sharelatex': { createClient: () => this.rclient }, '@overleaf/redis-wrapper': { createClient: () => this.rclient },
'settings-sharelatex': { 'settings-sharelatex': {
redis: { redis: {
history: (this.settings = { history: (this.settings = {

View file

@ -26,7 +26,7 @@ describe('LockManager - checking the lock', function () {
const mocks = { const mocks = {
'logger-sharelatex': { log() {} }, 'logger-sharelatex': { log() {} },
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient() { createClient() {
return { return {
auth() {}, auth() {},

View file

@ -31,7 +31,7 @@ describe('LockManager - releasing the lock', function () {
log() {}, log() {},
error() {} error() {}
}, },
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => this.client createClient: () => this.client
}, },
'settings-sharelatex': { 'settings-sharelatex': {

View file

@ -26,7 +26,7 @@ describe('LockManager - getting the lock', function () {
this.LockManager = SandboxedModule.require(modulePath, { this.LockManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'logger-sharelatex': { log() {} }, 'logger-sharelatex': { log() {} },
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => { createClient: () => {
return { auth() {} } return { auth() {} }
} }

View file

@ -23,7 +23,7 @@ describe('LockManager - trying the lock', function () {
this.LockManager = SandboxedModule.require(modulePath, { this.LockManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'logger-sharelatex': { log() {} }, 'logger-sharelatex': { log() {} },
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => { createClient: () => {
return { return {
auth() {}, auth() {},

View file

@ -44,7 +44,7 @@ describe('ProjectHistoryRedisManager', function () {
} }
} }
}), }),
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => this.rclient createClient: () => this.rclient
}, },
'logger-sharelatex': { 'logger-sharelatex': {

View file

@ -27,7 +27,7 @@ describe('RealTimeRedisManager', function () {
this.pubsubClient = { publish: sinon.stub() } this.pubsubClient = { publish: sinon.stub() }
this.RealTimeRedisManager = SandboxedModule.require(modulePath, { this.RealTimeRedisManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: (config) => createClient: (config) =>
config.name === 'pubsub' ? this.pubsubClient : this.rclient config.name === 'pubsub' ? this.pubsubClient : this.rclient
}, },

View file

@ -104,7 +104,7 @@ describe('RedisManager', function () {
} }
} }
}), }),
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => this.rclient createClient: () => this.rclient
}, },
'./Metrics': (this.metrics = { './Metrics': (this.metrics = {

View file

@ -30,7 +30,7 @@ describe('ShareJsUpdateManager', function () {
} }
}), }),
'./ShareJsDB': (this.ShareJsDB = { mockDB: true }), './ShareJsDB': (this.ShareJsDB = { mockDB: true }),
'redis-sharelatex': { '@overleaf/redis-wrapper': {
createClient: () => { createClient: () => {
return (this.rclient = { auth() {} }) return (this.rclient = { auth() {} })
} }