overleaf/services/document-updater/app/js/LockManager.js
Jakob Ackermann 8bc44141be Merge pull request #16590 from overleaf/jpa-redis-lock-60s
[server-ce] increase the doc lock TTL from 30s to 60s

GitOrigin-RevId: 468f7483cc6a80e8034e3cc8071b674123985deb
2024-01-19 09:06:06 +00:00

18 lines
531 B
JavaScript

const Settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(Settings.redis.lock)
const keys = Settings.redis.lock.key_schema
const RedisLocker = require('@overleaf/redis-wrapper/RedisLocker')
module.exports = new RedisLocker({
rclient,
getKey(docId) {
return keys.blockingKey({ doc_id: docId })
},
wrapTimeoutError(err, docId) {
err.doc_id = docId
return err
},
metricsPrefix: 'doc',
lockTTLSeconds: Settings.redisLockTTLSeconds,
})