mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 18:22:01 +00:00
limit parallel resync doc requests to web
This commit is contained in:
parent
e471730efb
commit
aa013f0bee
1 changed files with 3 additions and 1 deletions
|
@ -65,10 +65,12 @@ module.exports = HistoryManager =
|
||||||
newBlock = Math.floor(length / threshold)
|
newBlock = Math.floor(length / threshold)
|
||||||
return newBlock != prevBlock
|
return newBlock != prevBlock
|
||||||
|
|
||||||
|
MAX_PARALLEL_REQUESTS: 4
|
||||||
|
|
||||||
resyncProjectHistory: (project_id, projectHistoryId, docs, files, callback) ->
|
resyncProjectHistory: (project_id, projectHistoryId, docs, files, callback) ->
|
||||||
ProjectHistoryRedisManager.queueResyncProjectStructure project_id, projectHistoryId, docs, files, (error) ->
|
ProjectHistoryRedisManager.queueResyncProjectStructure project_id, projectHistoryId, docs, files, (error) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
DocumentManager = require "./DocumentManager"
|
DocumentManager = require "./DocumentManager"
|
||||||
resyncDoc = (doc, cb) ->
|
resyncDoc = (doc, cb) ->
|
||||||
DocumentManager.resyncDocContentsWithLock project_id, doc.doc, cb
|
DocumentManager.resyncDocContentsWithLock project_id, doc.doc, cb
|
||||||
async.each docs, resyncDoc, callback
|
async.eachLimit docs, HistoryManager.MAX_PARALLEL_REQUESTS, resyncDoc, callback
|
||||||
|
|
Loading…
Reference in a new issue