mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Don't throw fatal error when recently compiled
This commit is contained in:
parent
8bfc613bb3
commit
9a0ec9c292
2 changed files with 7 additions and 9 deletions
|
@ -26,7 +26,8 @@ module.exports = CompileManager =
|
|||
CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) ->
|
||||
return callback(error) if error?
|
||||
if recentlyCompiled
|
||||
return callback new Error("project was recently compiled so not continuing")
|
||||
logger.warn {project_id, user_id}, "project was recently compiled so not continuing"
|
||||
return callback null, "too-recently-compiled", []
|
||||
|
||||
CompileManager._ensureRootDocumentIsSet project_id, (error) ->
|
||||
return callback(error) if error?
|
||||
|
|
|
@ -27,7 +27,7 @@ describe "CompileManager", ->
|
|||
Timer: class Timer
|
||||
done: sinon.stub()
|
||||
inc: sinon.stub()
|
||||
"logger-sharelatex": @logger = { log: sinon.stub() }
|
||||
"logger-sharelatex": @logger = { log: sinon.stub(), warn: sinon.stub() }
|
||||
@project_id = "mock-project-id-123"
|
||||
@user_id = "mock-user-id-123"
|
||||
@callback = sinon.stub()
|
||||
|
@ -90,15 +90,12 @@ describe "CompileManager", ->
|
|||
.should.equal true
|
||||
|
||||
describe "when the project has been recently compiled", ->
|
||||
beforeEach ->
|
||||
it "should return", (done)->
|
||||
@CompileManager._checkIfAutoCompileLimitHasBeenHit = (_, cb)-> cb(null, true)
|
||||
@CompileManager._checkIfRecentlyCompiled = sinon.stub().callsArgWith(2, null, true)
|
||||
@CompileManager.compile @project_id, @user_id, {}, @callback
|
||||
|
||||
it "should return the callback with an error", ->
|
||||
@callback
|
||||
.calledWith(new Error("project was recently compiled so not continuing"))
|
||||
.should.equal true
|
||||
@CompileManager.compile @project_id, @user_id, {}, (err, status)->
|
||||
status.should.equal "too-recently-compiled"
|
||||
done()
|
||||
|
||||
describe "should check the rate limit", ->
|
||||
it "should return", (done)->
|
||||
|
|
Loading…
Reference in a new issue