mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add lock to unarchive doc
This commit is contained in:
parent
18f06a3daf
commit
7af5050370
1 changed files with 6 additions and 1 deletions
|
@ -52,9 +52,14 @@ module.exports = DocArchiveManager =
|
|||
else if !docs?
|
||||
return callback new Error("No docs for project #{project_id}")
|
||||
jobs = _.map docs, (doc) ->
|
||||
(cb)-> DocArchiveManager.unArchiveDocChanges project_id, doc._id, cb
|
||||
(cb)-> DocArchiveManager.unArchiveDocChangesWithLock project_id, doc._id, cb
|
||||
async.parallelLimit jobs, 4, callback
|
||||
|
||||
unArchiveDocChangesWithLock: (project_id, doc_id, callback = (error) ->) ->
|
||||
job = (releaseLock) ->
|
||||
DocArchiveManager.unArchiveDocChanges project_id, doc_id, releaseLock
|
||||
LockManager.runWithLock("HistoryLock:#{doc_id}", job, callback)
|
||||
|
||||
unArchiveDocChanges: (project_id, doc_id, callback)->
|
||||
MongoManager.getArchivedDocChanges doc_id, (error, count) ->
|
||||
return callback(error) if error?
|
||||
|
|
Loading…
Reference in a new issue