mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 11:53:40 -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,6 +60,11 @@ module.exports = DocArchive =
|
||||||
return callback new Errors.NotFoundError("Error in S3 request")
|
return callback new Errors.NotFoundError("Error in S3 request")
|
||||||
MongoManager.upsertIntoDocCollection project_id, doc_id.toString(), lines, (error) ->
|
MongoManager.upsertIntoDocCollection project_id, doc_id.toString(), lines, (error) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
|
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()
|
callback()
|
||||||
|
|
||||||
buildS3Options: (content, key)->
|
buildS3Options: (content, key)->
|
||||||
|
|
|
@ -25,6 +25,7 @@ describe "DocArchiveManager", ->
|
||||||
@request =
|
@request =
|
||||||
put: {}
|
put: {}
|
||||||
get: {}
|
get: {}
|
||||||
|
del: {}
|
||||||
|
|
||||||
@docs = [{
|
@docs = [{
|
||||||
_id: ObjectId()
|
_id: ObjectId()
|
||||||
|
@ -99,6 +100,7 @@ describe "DocArchiveManager", ->
|
||||||
|
|
||||||
it "should use correct options", (done)->
|
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
|
@requires["request"] = @request
|
||||||
@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires
|
@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue