mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
only archive entries older than the current update
to avoid a stale version of the current update ever being pulled back from S3
This commit is contained in:
parent
696a866b67
commit
dc0044020f
2 changed files with 6 additions and 2 deletions
|
@ -35,6 +35,9 @@ module.exports = DocArchiveManager =
|
|||
if count == 0
|
||||
logger.log {project_id, doc_id}, "document history is empty, not archiving"
|
||||
return callback()
|
||||
else if count == 1
|
||||
logger.log {project_id, doc_id}, "document history only has one entry, not archiving"
|
||||
return callback()
|
||||
else
|
||||
MongoManager.getArchivedDocChanges doc_id, (error, count) ->
|
||||
return callback(error) if error?
|
||||
|
@ -45,7 +48,7 @@ module.exports = DocArchiveManager =
|
|||
return callback(error) if error?
|
||||
MongoManager.markDocHistoryAsArchiveInProgress doc_id, update, (error) ->
|
||||
return callback(error) if error?
|
||||
MongoAWS.archiveDocHistory project_id, doc_id, (error) ->
|
||||
MongoAWS.archiveDocHistory project_id, doc_id, update, (error) ->
|
||||
if error?
|
||||
MongoManager.clearDocHistoryAsArchiveInProgress doc_id, update, (err) ->
|
||||
return callback(err) if err?
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = MongoAWS =
|
|||
MAX_SIZE: 1024*1024 # almost max size
|
||||
MAX_COUNT: 1024 # almost max count
|
||||
|
||||
archiveDocHistory: (project_id, doc_id, _callback = (error) ->) ->
|
||||
archiveDocHistory: (project_id, doc_id, update, _callback = (error) ->) ->
|
||||
|
||||
callback = (args...) ->
|
||||
_callback(args...)
|
||||
|
@ -19,6 +19,7 @@ module.exports = MongoAWS =
|
|||
|
||||
query = {
|
||||
doc_id: ObjectId(doc_id)
|
||||
v: {$lt: update.v}
|
||||
expiresAt: {$exists : false}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue