mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
remove unarchived docs from s3
This commit is contained in:
parent
9a68bfb393
commit
42f2afc4dd
2 changed files with 9 additions and 2 deletions
|
@ -60,7 +60,12 @@ module.exports = DocArchive =
|
|||
return callback new Errors.NotFoundError("Error in S3 request")
|
||||
MongoManager.upsertIntoDocCollection project_id, doc_id.toString(), lines, (error) ->
|
||||
return callback(error) if error?
|
||||
callback()
|
||||
logger.log project_id: project_id, doc_id: doc_id, "deleting doc from s3"
|
||||
request.del options, (err, res, body)->
|
||||
if err? || res.statusCode != 204
|
||||
logger.err err:err, res:res, "something went wrong deleting doc from aws"
|
||||
return callback new Errors.NotFoundError("Error in S3 request")
|
||||
callback()
|
||||
|
||||
buildS3Options: (content, key)->
|
||||
return {
|
||||
|
|
|
@ -25,6 +25,7 @@ describe "DocArchiveManager", ->
|
|||
@request =
|
||||
put: {}
|
||||
get: {}
|
||||
del: {}
|
||||
|
||||
@docs = [{
|
||||
_id: ObjectId()
|
||||
|
@ -98,7 +99,8 @@ describe "DocArchiveManager", ->
|
|||
describe "unarchiveDoc", ->
|
||||
|
||||
it "should use correct options", (done)->
|
||||
@request.get = sinon.stub().callsArgWith(1, null, statusCode:200, @docs[0].lines)
|
||||
@request.get = sinon.stub().callsArgWith(1, null, statusCode:200, @docs[0].lines)
|
||||
@request.del = sinon.stub().callsArgWith(1, null, statusCode:204, {})
|
||||
@requires["request"] = @request
|
||||
@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires
|
||||
|
||||
|
|
Loading…
Reference in a new issue