2021-07-12 16:47:15 +00:00
|
|
|
const Settings = require('@overleaf/settings')
|
2020-11-10 11:32:04 +00:00
|
|
|
const redis = require('@overleaf/redis-wrapper')
|
2020-05-06 10:09:33 +00:00
|
|
|
const rclient = redis.createClient(Settings.redis.lock)
|
|
|
|
const keys = Settings.redis.lock.key_schema
|
2022-05-18 08:22:20 +00:00
|
|
|
const RedisLocker = require('@overleaf/redis-wrapper/RedisLocker')
|
2016-04-13 10:59:56 +00:00
|
|
|
|
2022-05-18 08:22:20 +00:00
|
|
|
module.exports = new RedisLocker({
|
|
|
|
rclient,
|
|
|
|
getKey(docId) {
|
|
|
|
return keys.blockingKey({ doc_id: docId })
|
2020-05-06 10:09:33 +00:00
|
|
|
},
|
2022-05-18 08:22:20 +00:00
|
|
|
wrapTimeoutError(err, docId) {
|
|
|
|
err.doc_id = docId
|
|
|
|
return err
|
2021-07-13 11:04:42 +00:00
|
|
|
},
|
2022-05-18 08:22:20 +00:00
|
|
|
metricsPrefix: 'doc',
|
|
|
|
})
|