mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-06 15:12:07 +00:00
no need to support optional keys.projectState
This commit is contained in:
parent
bd6b5b2c59
commit
47bebf9638
2 changed files with 10 additions and 12 deletions
|
@ -90,21 +90,17 @@ module.exports = RedisManager =
|
|||
return callback(error) if error?
|
||||
multi = rclient.multi()
|
||||
multi.srem keys.docsInProject(project_id:project_id), doc_id
|
||||
if keys.projectState?
|
||||
multi.del keys.projectState(project_id:project_id)
|
||||
multi.del keys.projectState(project_id:project_id)
|
||||
multi.exec callback
|
||||
|
||||
checkOrSetProjectState: (project_id, newState, callback = (error, stateChanged) ->) ->
|
||||
if keys.projectState?
|
||||
multi = rclient.multi()
|
||||
multi.getset keys.projectState(project_id:project_id), newState
|
||||
multi.expire keys.projectState(project_id:project_id), 30 * minutes
|
||||
multi.exec (error, response) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, newState:newState, oldState: response[0], "checking project state"
|
||||
callback(null, response[0] isnt newState)
|
||||
else
|
||||
callback(null,true)
|
||||
multi = rclient.multi()
|
||||
multi.getset keys.projectState(project_id:project_id), newState
|
||||
multi.expire keys.projectState(project_id:project_id), 30 * minutes
|
||||
multi.exec (error, response) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, newState:newState, oldState: response[0], "checking project state"
|
||||
callback(null, response[0] isnt newState)
|
||||
|
||||
getDoc : (project_id, doc_id, callback = (error, lines, version, ranges) ->)->
|
||||
timer = new metrics.Timer("redis.get-doc")
|
||||
|
|
|
@ -41,6 +41,7 @@ module.exports =
|
|||
projectKey: ({doc_id}) -> "ProjectId:#{doc_id}"
|
||||
docsInProject: ({project_id}) -> "DocsIn:#{project_id}"
|
||||
ranges: ({doc_id}) -> "Ranges:#{doc_id}"
|
||||
projectState: ({project_id}) -> "ProjectState:#{project_id}"
|
||||
# cluster: [{
|
||||
# port: "7000"
|
||||
# host: "localhost"
|
||||
|
@ -54,6 +55,7 @@ module.exports =
|
|||
# projectKey: ({doc_id}) -> "ProjectId:{#{doc_id}}"
|
||||
# docsInProject: ({project_id}) -> "DocsIn:{#{project_id}}"
|
||||
# ranges: ({doc_id}) -> "Ranges:{#{doc_id}}"
|
||||
# projectState: ({project_id}) -> "ProjectState:{#{project_id}}"
|
||||
history:
|
||||
port:"6379"
|
||||
host:"localhost"
|
||||
|
|
Loading…
Add table
Reference in a new issue