mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Remove unused total doc counting redis commands
This commit is contained in:
parent
32ce44f9c6
commit
b2e58266ae
4 changed files with 0 additions and 63 deletions
|
@ -1,4 +1,3 @@
|
|||
ALLDOCSKEY = "AllDocIds"
|
||||
PROJECTKEY = "ProjectId"
|
||||
BLOCKINGKEY = "Blocking"
|
||||
CHANGEQUE = "ChangeQue"
|
||||
|
@ -12,8 +11,6 @@ DOCSWITHHISTORYOPS = "DocsWithHistoryOps"
|
|||
UNCOMPRESSED_HISTORY_OPS = "UncompressedHistoryOps"
|
||||
|
||||
module.exports =
|
||||
|
||||
allDocs : ALLDOCSKEY
|
||||
docLines : (op)-> DOCLINES+":"+op.doc_id
|
||||
docOps : (op)-> DOCOPS+":"+op.doc_id
|
||||
uncompressedHistoryOp: (op) -> UNCOMPRESSED_HISTORY_OPS + ":" + op.doc_id
|
||||
|
@ -27,6 +24,3 @@ module.exports =
|
|||
combineProjectIdAndDocId: (project_id, doc_id) -> "#{project_id}:#{doc_id}"
|
||||
splitProjectIdAndDocId: (project_and_doc_id) -> project_and_doc_id.split(":")
|
||||
docsWithHistoryOps: (op) -> DOCSWITHHISTORYOPS + ":" + op.project_id
|
||||
now : (key)->
|
||||
d = new Date()
|
||||
d.getDate()+":"+(d.getMonth()+1)+":"+d.getFullYear()+":"+key
|
||||
|
|
|
@ -22,7 +22,6 @@ module.exports = RedisManager =
|
|||
multi.set keys.docLines(doc_id:doc_id), JSON.stringify(docLines)
|
||||
multi.set keys.projectKey({doc_id:doc_id}), project_id
|
||||
multi.set keys.docVersion(doc_id:doc_id), version
|
||||
multi.sadd keys.allDocs, doc_id
|
||||
multi.sadd keys.docsInProject(project_id:project_id), doc_id
|
||||
multi.exec (err, replys)->
|
||||
timer.done()
|
||||
|
@ -35,7 +34,6 @@ module.exports = RedisManager =
|
|||
multi.del keys.projectKey(doc_id:doc_id)
|
||||
multi.del keys.docVersion(doc_id:doc_id)
|
||||
multi.srem keys.docsInProject(project_id:project_id), doc_id
|
||||
multi.srem keys.allDocs, doc_id
|
||||
multi.exec (err, replys)->
|
||||
if err?
|
||||
logger.err project_id:project_id, doc_id:doc_id, err:err, "error removing doc from redis"
|
||||
|
@ -65,16 +63,10 @@ module.exports = RedisManager =
|
|||
version = parseInt(version, 10)
|
||||
callback null, version
|
||||
|
||||
getCountOfDocsInMemory : (callback)->
|
||||
rclient.smembers keys.allDocs, (err, members)->
|
||||
len = members.length
|
||||
callback null, len
|
||||
|
||||
setDocument : (doc_id, docLines, version, callback = (error) ->)->
|
||||
multi = rclient.multi()
|
||||
multi.set keys.docLines(doc_id:doc_id), JSON.stringify(docLines)
|
||||
multi.set keys.docVersion(doc_id:doc_id), version
|
||||
multi.incr keys.now("docsets")
|
||||
multi.exec (error, replys) -> callback(error)
|
||||
|
||||
getPendingUpdatesForDoc : (doc_id, callback)->
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
require('coffee-script')
|
||||
assert = require('assert')
|
||||
should = require('chai').should()
|
||||
path = require('path')
|
||||
modulePath = path.join __dirname, '../../../../app/js/RedisManager.js'
|
||||
keys = require(path.join __dirname, '../../../../app/js/RedisKeyBuilder.js')
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
|
||||
describe 'RedisManager.getCountOfDocsInMemory', ()->
|
||||
|
||||
project_id = "12345"
|
||||
doc_id1 = "docid1"
|
||||
doc_id2 = "docid2"
|
||||
doc_id3 = "docid3"
|
||||
|
||||
redisMemory = {}
|
||||
redisManager = undefined
|
||||
|
||||
beforeEach (done)->
|
||||
mocks =
|
||||
"./ZipManager": {}
|
||||
"logger-sharelatex": log:->
|
||||
"redis-sharelatex":
|
||||
createClient : ()->
|
||||
auth:->
|
||||
smembers:(key, callback)->
|
||||
callback(null, redisMemory[key])
|
||||
multi: ()->
|
||||
set:(key, value)->
|
||||
redisMemory[key] = value
|
||||
sadd:(key, value)->
|
||||
if !redisMemory[key]?
|
||||
redisMemory[key] = []
|
||||
redisMemory[key].push value
|
||||
del:()->
|
||||
exec:(callback)->
|
||||
callback()
|
||||
|
||||
redisManager = SandboxedModule.require(modulePath, requires: mocks)
|
||||
redisManager.putDocInMemory project_id, doc_id1, 0, ["line"], ->
|
||||
redisManager.putDocInMemory project_id, doc_id2, 0, ["ledf"], ->
|
||||
redisManager.putDocInMemory project_id, doc_id3, 0, ["ledf"], ->
|
||||
done()
|
||||
|
||||
it 'should return total', (done)->
|
||||
redisManager.getCountOfDocsInMemory (err, count)->
|
||||
assert.equal count, 3
|
||||
done()
|
|
@ -17,7 +17,6 @@ describe 'RedisManager.putDocInMemory', ()->
|
|||
potentialSets[keys.docVersion(doc_id:doc_id)] = version
|
||||
|
||||
potentialSAdds = {}
|
||||
potentialSAdds[keys.allDocs] = doc_id
|
||||
potentialSAdds[keys.docsInProject(project_id:project_id)] = doc_id
|
||||
|
||||
mocks =
|
||||
|
|
Loading…
Reference in a new issue