mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Try to put a new doc in the docstore first so that if it fails it doesn't leave a broken doc_id in the project
This commit is contained in:
parent
bafd3a1cb4
commit
36678301e6
1 changed files with 6 additions and 4 deletions
|
@ -116,9 +116,11 @@ module.exports = ProjectEntityHandler =
|
|||
return callback(err) if err?
|
||||
confirmFolder project, folder_id, (folder_id)=>
|
||||
doc = new Doc name: docName
|
||||
Project.putElement project._id, folder_id, doc, "doc", (err, result)=>
|
||||
return callback(err) if err?
|
||||
# Put doc in docstore first, so that if it errors, we don't have a doc_id in the project
|
||||
# which hasn't been created in docstore.
|
||||
DocstoreManager.updateDoc project._id.toString(), doc._id.toString(), docLines, (err, modified, rev) ->
|
||||
return callback(err) if err?
|
||||
Project.putElement project._id, folder_id, doc, "doc", (err, result)=>
|
||||
return callback(err) if err?
|
||||
tpdsUpdateSender.addDoc {
|
||||
project_id: project._id,
|
||||
|
|
Loading…
Reference in a new issue