mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 13:53:37 -05:00
add comment about upsert and locking
This commit is contained in:
parent
baec4eb195
commit
cdfa2de68d
1 changed files with 5 additions and 0 deletions
|
@ -261,6 +261,11 @@ module.exports = ProjectEntityUpdateHandler = self =
|
||||||
return callback(err) if err?
|
return callback(err) if err?
|
||||||
callback null, doc, !existingDoc?
|
callback null, doc, !existingDoc?
|
||||||
|
|
||||||
|
# FIXME: this method needs to be changed, currently it needs a lock around an upload to S3 because
|
||||||
|
# there is no way to know in advance if the file is a replace or an insert (at least you have to
|
||||||
|
# take the lock to find that out and do any operation in that lock). In the new scheme any upsert
|
||||||
|
# should always create the new file (outside the lock) in S3 first and then make the changes to the
|
||||||
|
# project in a lock, marking the old file as deleted if it exists.
|
||||||
upsertFile: wrapWithLock (project_id, folder_id, fileName, fsPath, linkedFileData, userId, callback = (err, file, isNewFile)->)->
|
upsertFile: wrapWithLock (project_id, folder_id, fileName, fsPath, linkedFileData, userId, callback = (err, file, isNewFile)->)->
|
||||||
ProjectLocator.findElement project_id: project_id, element_id: folder_id, type: "folder", (error, folder) ->
|
ProjectLocator.findElement project_id: project_id, element_id: folder_id, type: "folder", (error, folder) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
|
|
Loading…
Reference in a new issue