Merge pull request #503 from sharelatex/ja-reorder-compile-rate-limits

Re-order compile rate limits
This commit is contained in:
James Allen 2018-05-01 08:48:22 +01:00 committed by GitHub
commit 4c7364fd01

View file

@ -18,15 +18,16 @@ module.exports = CompileManager =
timer.done() timer.done()
_callback(args...) _callback(args...)
@_checkIfAutoCompileLimitHasBeenHit options.isAutoCompile, "everyone", (err, canCompile)-> logger.log project_id: project_id, user_id: user_id, "compiling project"
if !canCompile CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) ->
return callback null, "autocompile-backoff", [] return callback(error) if error?
logger.log project_id: project_id, user_id: user_id, "compiling project" if recentlyCompiled
CompileManager._checkIfRecentlyCompiled project_id, user_id, (error, recentlyCompiled) -> logger.warn {project_id, user_id}, "project was recently compiled so not continuing"
return callback(error) if error? return callback null, "too-recently-compiled", []
if recentlyCompiled
logger.warn {project_id, user_id}, "project was recently compiled so not continuing" CompileManager._checkIfAutoCompileLimitHasBeenHit options.isAutoCompile, "everyone", (err, canCompile)->
return callback null, "too-recently-compiled", [] if !canCompile
return callback null, "autocompile-backoff", []
CompileManager._ensureRootDocumentIsSet project_id, (error) -> CompileManager._ensureRootDocumentIsSet project_id, (error) ->
return callback(error) if error? return callback(error) if error?