mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 02:13:35 -05:00
8136036c33
Promisify UpdateManager GitOrigin-RevId: 2c3e21ee6ef2454f79695ca8623c3d38720ff6bf
18 lines
531 B
JavaScript
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,
|
|
})
|