mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #24749 from overleaf/bg-history-redis-buffer
add history redis to history-v1 GitOrigin-RevId: 70dc1aee809ad17902c93c020f3804c0f1429238
This commit is contained in:
@@ -89,6 +89,16 @@
|
||||
"host": "QUEUES_REDIS_HOST",
|
||||
"password": "QUEUES_REDIS_PASSWORD",
|
||||
"port": "QUEUES_REDIS_PORT"
|
||||
},
|
||||
"history": {
|
||||
"host": "HISTORY_REDIS_HOST",
|
||||
"password": "HISTORY_REDIS_PASSWORD",
|
||||
"port": "HISTORY_REDIS_PORT"
|
||||
},
|
||||
"lock": {
|
||||
"host": "REDIS_HOST",
|
||||
"password": "REDIS_PASSWORD",
|
||||
"port": "REDIS_PORT"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
import redis from '@overleaf/redis-wrapper'
|
||||
import config from 'config'
|
||||
|
||||
const redisOptions = config.get('redis.queue')
|
||||
// Get allowed Redis dbs from config
|
||||
const redisConfig = config.get('redis')
|
||||
const allowedDbs = Object.keys(redisConfig)
|
||||
|
||||
// Get the Redis db from command line argument or use the first available db as default
|
||||
const db = process.argv[2]
|
||||
|
||||
// Validate redis db
|
||||
if (!allowedDbs.includes(db)) {
|
||||
if (db) {
|
||||
console.error('Invalid redis db:', db)
|
||||
}
|
||||
console.error(`Usage: node redis.mjs [${allowedDbs.join('|')}]`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Get redis options based on command line argument
|
||||
const redisOptions = config.get(`redis.${db}`)
|
||||
console.log('Using redis db:', db)
|
||||
console.log('REDIS CONFIG', {
|
||||
...redisOptions,
|
||||
password: '*'.repeat(redisOptions.password.length),
|
||||
password: '*'.repeat(redisOptions.password?.length),
|
||||
})
|
||||
const rclient = redis.createClient(redisOptions)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user