mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #6962 from overleaf/jpa-clsi-tweak-health-check
[clsi] tweak health check GitOrigin-RevId: 2caad90d55bb441c7008e3084b34d683b072dfbd
This commit is contained in:
parent
a3e85f5357
commit
b25ff076b8
3 changed files with 18 additions and 1 deletions
|
@ -271,10 +271,18 @@ if (Settings.processLifespanLimitMs) {
|
|||
|
||||
function runSmokeTest() {
|
||||
if (Settings.processTooOld) return
|
||||
const INTERVAL = 30 * 1000
|
||||
if (
|
||||
smokeTest.lastRunSuccessful() &&
|
||||
Date.now() - CompileController.lastSuccessfulCompile < INTERVAL / 2
|
||||
) {
|
||||
logger.log('skipping smoke tests, got recent successful user compile')
|
||||
return setTimeout(runSmokeTest, INTERVAL / 2)
|
||||
}
|
||||
logger.log('running smoke tests')
|
||||
smokeTest.triggerRun(err => {
|
||||
if (err) logger.error({ err }, 'smoke tests failed')
|
||||
setTimeout(runSmokeTest, 30 * 1000)
|
||||
setTimeout(runSmokeTest, INTERVAL)
|
||||
})
|
||||
}
|
||||
if (Settings.smokeTest) {
|
||||
|
|
|
@ -27,6 +27,8 @@ function isImageNameAllowed(imageName) {
|
|||
}
|
||||
|
||||
module.exports = CompileController = {
|
||||
lastSuccessfulCompile: 0,
|
||||
|
||||
compile(req, res, next) {
|
||||
if (next == null) {
|
||||
next = function () {}
|
||||
|
@ -87,6 +89,7 @@ module.exports = CompileController = {
|
|||
for (file of Array.from(outputFiles)) {
|
||||
if (file.path === 'output.pdf' && file.size > 0) {
|
||||
status = 'success'
|
||||
CompileController.lastSuccessfulCompile = Date.now()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@ module.exports = {
|
|||
cb(error)
|
||||
})
|
||||
},
|
||||
lastRunSuccessful() {
|
||||
return this._lastError == null
|
||||
},
|
||||
|
||||
_lastError: new Error('SmokeTestsPending'),
|
||||
_sendResponse(res, error) {
|
||||
|
@ -39,6 +42,9 @@ module.exports = {
|
|||
url,
|
||||
json: {
|
||||
compile: {
|
||||
options: {
|
||||
metricsPath: 'health-check',
|
||||
},
|
||||
resources: [
|
||||
{
|
||||
path: 'main.tex',
|
||||
|
|
Loading…
Reference in a new issue