mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #149 from overleaf/jpa-redis-wrapper-rewrite
[misc] bump @overleaf/redis-wrapper to version 2.0.0
This commit is contained in:
commit
3564dc0140
26 changed files with 185 additions and 220 deletions
|
@ -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
|
||||
)
|
||||
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
|
||||
)
|
||||
app.get('/health_check/redis_cluster', (req, res, next) => {
|
||||
|
|
|
@ -18,7 +18,7 @@ let DispatchManager
|
|||
const Settings = require('settings-sharelatex')
|
||||
const logger = require('logger-sharelatex')
|
||||
const Keys = require('./UpdateKeys')
|
||||
const redis = require('redis-sharelatex')
|
||||
const redis = require('@overleaf/redis-wrapper')
|
||||
const Errors = require('./Errors')
|
||||
|
||||
const UpdateManager = require('./UpdateManager')
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
*/
|
||||
let HistoryRedisManager
|
||||
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 logger = require('logger-sharelatex')
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
let LockManager
|
||||
const metrics = require('./Metrics')
|
||||
const Settings = require('settings-sharelatex')
|
||||
const redis = require('redis-sharelatex')
|
||||
const redis = require('@overleaf/redis-wrapper')
|
||||
const rclient = redis.createClient(Settings.redis.lock)
|
||||
const keys = Settings.redis.lock.key_schema
|
||||
const logger = require('logger-sharelatex')
|
||||
|
|
|
@ -19,7 +19,7 @@ const projectHistoryKeys = __guard__(
|
|||
Settings.redis != null ? Settings.redis.project_history : undefined,
|
||||
(x) => x.key_schema
|
||||
)
|
||||
const rclient = require('redis-sharelatex').createClient(
|
||||
const rclient = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.project_history
|
||||
)
|
||||
const logger = require('logger-sharelatex')
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
*/
|
||||
let RealTimeRedisManager
|
||||
const Settings = require('settings-sharelatex')
|
||||
const rclient = require('redis-sharelatex').createClient(
|
||||
const rclient = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.documentupdater
|
||||
)
|
||||
const pubsubClient = require('redis-sharelatex').createClient(
|
||||
const pubsubClient = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.pubsub
|
||||
)
|
||||
const Keys = Settings.redis.documentupdater.key_schema
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
let RedisManager
|
||||
const Settings = require('settings-sharelatex')
|
||||
const rclient = require('redis-sharelatex').createClient(
|
||||
const rclient = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.documentupdater
|
||||
)
|
||||
const logger = require('logger-sharelatex')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
async = require "async"
|
||||
RedisManager = require "./app/js/RedisManager"
|
||||
|
@ -41,4 +41,4 @@ setTimeout () -> # Give redis a chance to connect
|
|||
expireDocOps (error) ->
|
||||
throw error if error?
|
||||
process.exit()
|
||||
, 1000
|
||||
, 1000
|
||||
|
|
336
services/document-updater/package-lock.json
generated
336
services/document-updater/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,8 @@
|
|||
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
|
||||
},
|
||||
"dependencies": {
|
||||
"@overleaf/o-error": "^3.1.0",
|
||||
"@overleaf/redis-wrapper": "^2.0.0",
|
||||
"async": "^2.5.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"bunyan": "~0.22.1",
|
||||
|
@ -26,7 +28,6 @@
|
|||
"logger-sharelatex": "^1.9.1",
|
||||
"metrics-sharelatex": "^2.6.2",
|
||||
"mongodb": "^3.6.0",
|
||||
"redis-sharelatex": "^1.0.13",
|
||||
"request": "^2.88.2",
|
||||
"requestretry": "^4.1.0",
|
||||
"settings-sharelatex": "^1.1.0"
|
||||
|
|
|
@ -17,13 +17,13 @@ chai.should()
|
|||
const { expect } = chai
|
||||
const async = require('async')
|
||||
const Settings = require('settings-sharelatex')
|
||||
const rclient_history = require('redis-sharelatex').createClient(
|
||||
const rclient_history = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.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
|
||||
)
|
||||
const rclient_du = require('redis-sharelatex').createClient(
|
||||
const rclient_du = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.documentupdater
|
||||
)
|
||||
const Keys = Settings.redis.documentupdater.key_schema
|
||||
|
|
|
@ -2,7 +2,7 @@ const sinon = require('sinon')
|
|||
const chai = require('chai')
|
||||
chai.should()
|
||||
const Settings = require('settings-sharelatex')
|
||||
const rclientProjectHistory = require('redis-sharelatex').createClient(
|
||||
const rclientProjectHistory = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.project_history
|
||||
)
|
||||
const ProjectHistoryKeys = Settings.redis.project_history.key_schema
|
||||
|
|
|
@ -3,7 +3,7 @@ const chai = require('chai')
|
|||
chai.should()
|
||||
const { expect } = require('chai')
|
||||
const Settings = require('settings-sharelatex')
|
||||
const docUpdaterRedis = require('redis-sharelatex').createClient(
|
||||
const docUpdaterRedis = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.documentupdater
|
||||
)
|
||||
const Keys = Settings.redis.documentupdater.key_schema
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
let DocUpdaterClient
|
||||
const Settings = require('settings-sharelatex')
|
||||
const rclient = require('redis-sharelatex').createClient(
|
||||
const rclient = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.documentupdater
|
||||
)
|
||||
const keys = Settings.redis.documentupdater.key_schema
|
||||
const request = require('request').defaults({ jar: false })
|
||||
const async = require('async')
|
||||
|
||||
const rclientSub = require('redis-sharelatex').createClient(
|
||||
const rclientSub = require('@overleaf/redis-wrapper').createClient(
|
||||
Settings.redis.pubsub
|
||||
)
|
||||
rclientSub.subscribe('applied-ops')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
redis = require "redis-sharelatex"
|
||||
redis = require "@overleaf/redis-wrapper"
|
||||
rclient1 = redis.createClient(cluster: [{
|
||||
port: "7000"
|
||||
host: "localhost"
|
||||
|
@ -36,6 +36,6 @@ do sendPings = () ->
|
|||
setTimeout sendPings, PING_DELAY
|
||||
|
||||
do listenInBackground = (cb = () ->) ->
|
||||
listenForPing (error, value) ->
|
||||
listenForPing (error, value) ->
|
||||
console.error "[RECEIVING ERROR]", error.message if error
|
||||
setTimeout listenInBackground
|
||||
setTimeout listenInBackground
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
redis = require "redis-sharelatex"
|
||||
redis = require "@overleaf/redis-wrapper"
|
||||
rclient1 = redis.createClient(cluster: [{
|
||||
port: "7000"
|
||||
host: "localhost"
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('DispatchManager', function () {
|
|||
documentupdater: {}
|
||||
}
|
||||
}),
|
||||
'redis-sharelatex': (this.redis = {}),
|
||||
'@overleaf/redis-wrapper': (this.redis = {}),
|
||||
'./RateLimitManager': {},
|
||||
'./Errors': Errors,
|
||||
'./Metrics': (this.Metrics = {
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('HistoryRedisManager', function () {
|
|||
this.rclient.multi = () => this.rclient
|
||||
this.HistoryRedisManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'redis-sharelatex': { createClient: () => this.rclient },
|
||||
'@overleaf/redis-wrapper': { createClient: () => this.rclient },
|
||||
'settings-sharelatex': {
|
||||
redis: {
|
||||
history: (this.settings = {
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('LockManager - checking the lock', function () {
|
|||
|
||||
const mocks = {
|
||||
'logger-sharelatex': { log() {} },
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient() {
|
||||
return {
|
||||
auth() {},
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('LockManager - releasing the lock', function () {
|
|||
log() {},
|
||||
error() {}
|
||||
},
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => this.client
|
||||
},
|
||||
'settings-sharelatex': {
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('LockManager - getting the lock', function () {
|
|||
this.LockManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'logger-sharelatex': { log() {} },
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => {
|
||||
return { auth() {} }
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('LockManager - trying the lock', function () {
|
|||
this.LockManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'logger-sharelatex': { log() {} },
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => {
|
||||
return {
|
||||
auth() {},
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('ProjectHistoryRedisManager', function () {
|
|||
}
|
||||
}
|
||||
}),
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => this.rclient
|
||||
},
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('RealTimeRedisManager', function () {
|
|||
this.pubsubClient = { publish: sinon.stub() }
|
||||
this.RealTimeRedisManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: (config) =>
|
||||
config.name === 'pubsub' ? this.pubsubClient : this.rclient
|
||||
},
|
||||
|
|
|
@ -104,7 +104,7 @@ describe('RedisManager', function () {
|
|||
}
|
||||
}
|
||||
}),
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => this.rclient
|
||||
},
|
||||
'./Metrics': (this.metrics = {
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('ShareJsUpdateManager', function () {
|
|||
}
|
||||
}),
|
||||
'./ShareJsDB': (this.ShareJsDB = { mockDB: true }),
|
||||
'redis-sharelatex': {
|
||||
'@overleaf/redis-wrapper': {
|
||||
createClient: () => {
|
||||
return (this.rclient = { auth() {} })
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue