overleaf/services/document-updater/app/js/LockManager.js

19 lines
531 B
JavaScript
Raw Normal View History

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
2021-07-13 07:04:42 -04:00
},
metricsPrefix: 'doc',
lockTTLSeconds: Settings.redisLockTTLSeconds,
})