mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-14 22:35:25 +00:00
[DockerRunner] fix metric incrementing and error logging
- do not log on first EPIPE - inc 'container-inspect-epipe-error' on permanent error only Co-Authored-By: Tim Alby <timothee.alby@gmail.com>
This commit is contained in:
parent
ecaa7035f5
commit
cb9e9321f0
1 changed files with 10 additions and 13 deletions
|
@ -408,31 +408,28 @@ module.exports = DockerRunner = {
|
|||
})
|
||||
}
|
||||
)
|
||||
|
||||
const callbackWithRetry = error => {
|
||||
if (error.message.match(/EPIPE/)) {
|
||||
metrics.inc('container-inspect-epipe-retry')
|
||||
return inspectContainer(container, callback)
|
||||
}
|
||||
callback(error)
|
||||
}
|
||||
|
||||
var inspectContainer = (container, innerCallback) =>
|
||||
var inspectContainer = (isRetry) =>
|
||||
container.inspect(function(error, stats) {
|
||||
if ((error != null ? error.statusCode : undefined) === 404) {
|
||||
return createAndStartContainer()
|
||||
} else if (error != null) {
|
||||
metrics.inc('container-inspect-epipe-error')
|
||||
if (error.message.match(/EPIPE/)) {
|
||||
if (!isRetry) {
|
||||
metrics.inc('container-inspect-epipe-retry')
|
||||
return inspectContainer(true)
|
||||
}
|
||||
metrics.inc('container-inspect-epipe-error')
|
||||
}
|
||||
logger.err(
|
||||
{ container_name: name, error },
|
||||
'unable to inspect container to start'
|
||||
)
|
||||
return innerCallback(error)
|
||||
return callback(error)
|
||||
} else {
|
||||
return startExistingContainer()
|
||||
}
|
||||
})
|
||||
inspectContainer(container, callbackWithRetry)
|
||||
inspectContainer(false)
|
||||
},
|
||||
|
||||
attachToContainer(containerId, attachStreamHandler, attachStartCallback) {
|
||||
|
|
Loading…
Add table
Reference in a new issue