mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 05:52:57 +00:00
Increase redis lock expiry time to 30 seconds
This commit is contained in:
parent
c2ebaaa338
commit
d1434f7646
2 changed files with 3 additions and 3 deletions
|
@ -10,10 +10,10 @@ logger = require "logger-sharelatex"
|
|||
module.exports = LockManager =
|
||||
LOCK_TEST_INTERVAL: 50 # 50ms between each test of the lock
|
||||
MAX_LOCK_WAIT_TIME: 10000 # 10s maximum time to spend trying to get the lock
|
||||
REDIS_LOCK_EXPIRY: 30 # seconds. Time until lock auto expires in redis.
|
||||
|
||||
tryLock : (doc_id, callback = (err, isFree)->)->
|
||||
tenSeconds = 10
|
||||
rclient.set keys.blockingKey(doc_id: doc_id), "locked", "EX", 10, "NX", (err, gotLock)->
|
||||
rclient.set keys.blockingKey(doc_id: doc_id), "locked", "EX", LockManager.REDIS_LOCK_EXPIRY, "NX", (err, gotLock)->
|
||||
return callback(err) if err?
|
||||
if gotLock == "OK"
|
||||
metrics.inc "doc-not-blocking"
|
||||
|
|
|
@ -21,7 +21,7 @@ describe 'LockManager - trying the lock', ->
|
|||
@LockManager.tryLock @doc_id, @callback
|
||||
|
||||
it "should set the lock key with an expiry if it is not set", ->
|
||||
@set.calledWith("Blocking:#{@doc_id}", "locked", "EX", 10, "NX")
|
||||
@set.calledWith("Blocking:#{@doc_id}", "locked", "EX", 30, "NX")
|
||||
.should.equal true
|
||||
|
||||
it "should return the callback with true", ->
|
||||
|
|
Loading…
Reference in a new issue