reduce logging

This commit is contained in:
Henry Oswald 2018-08-01 13:59:09 +01:00
parent ac4d07352f
commit 44c0922a5b
4 changed files with 7 additions and 14 deletions

View file

@ -2,7 +2,6 @@ async = require "async"
Settings = require "settings-sharelatex"
queue = async.queue((task, cb)->
console.log("running task")
task(cb)
, Settings.parallelSqlQueryLimit)

View file

@ -46,7 +46,9 @@ module.exports = DockerRunner =
fingerprint = DockerRunner._fingerprintContainer(options)
options.name = name = "project-#{project_id}-#{fingerprint}"
logger.log project_id: project_id, options: options, "running docker container"
logOptions = _.clone(options)
logOptions.HostConfig.SecurityOpt = "secomp used, removed in logging"
logger.log project_id: project_id, options:logOptions, "running docker container"
DockerRunner._runAndWaitForContainer options, volumes, timeout, (error, output) ->
if error?.message?.match("HTTP code is 500")
logger.log err: error, project_id: project_id, "error running container so destroying and retrying"
@ -144,14 +146,14 @@ module.exports = DockerRunner =
"Ulimits": [{'Name': 'cpu', 'Soft': timeoutInSeconds+5, 'Hard': timeoutInSeconds+10}]
"CapDrop": "ALL"
"SecurityOpt": ["no-new-privileges"]
if Settings.clsi.docker.seccomp_profile?
options.HostConfig.SecurityOpt.push "seccomp=#{Settings.clsi.docker.seccomp_profile}"
if Settings.path?.synctexBinHostPath?
options["HostConfig"]["Binds"].push("#{Settings.path.synctexBinHostPath}:/opt/synctex:ro")
logger.log options:options, "options for running docker container"
if Settings.clsi.docker.seccomp_profile?
options.HostConfig.SecurityOpt.push "seccomp=#{Settings.clsi.docker.seccomp_profile}"
return options
_fingerprintContainer: (containerOptions) ->

View file

@ -13,7 +13,6 @@ module.exports = ProjectPersistenceManager =
markProjectAsJustAccessed: (project_id, callback = (error) ->) ->
job = (cb)->
console.log("markProjectAsJustAccessed")
db.Project.findOrCreate(where: {project_id: project_id})
.spread(
(project, created) ->
@ -59,7 +58,6 @@ module.exports = ProjectPersistenceManager =
_clearProjectFromDatabase: (project_id, callback = (error) ->) ->
job = (cb)->
console.log("_clearProjectFromDatabase")
db.Project.destroy(where: {project_id: project_id})
.then(() -> cb())
.error cb
@ -69,7 +67,6 @@ module.exports = ProjectPersistenceManager =
_findExpiredProjectIds: (callback = (error, project_ids) ->) ->
job = (cb)->
keepProjectsFrom = new Date(Date.now() - ProjectPersistenceManager.EXPIRY_TIMEOUT)
console.log("_findExpiredProjectIds", keepProjectsFrom)
q = {}
q[db.op.gt] = keepProjectsFrom
db.Project.findAll(where:{lastAccessed:q})

View file

@ -52,9 +52,7 @@ module.exports = UrlCache =
_doesUrlNeedDownloading: (project_id, url, lastModified, callback = (error, needsDownloading) ->) ->
if !lastModified?
return callback null, true
console.log "about to get _findUrlDetails"
UrlCache._findUrlDetails project_id, url, (error, urlDetails) ->
console.log error, urlDetails, "_findUrlDetails result"
return callback(error) if error?
if !urlDetails? or !urlDetails.lastModified? or urlDetails.lastModified.getTime() < lastModified.getTime()
return callback null, true
@ -104,7 +102,6 @@ module.exports = UrlCache =
_updateOrCreateUrlDetails: (project_id, url, lastModified, callback = (error) ->) ->
job = (cb)->
console.log("_updateOrCreateUrlDetails")
db.UrlCache.findOrCreate(where: {url: url, project_id: project_id})
.spread(
(urlDetails, created) ->
@ -117,7 +114,6 @@ module.exports = UrlCache =
_clearUrlDetails: (project_id, url, callback = (error) ->) ->
job = (cb)->
console.log("_clearUrlDetails")
db.UrlCache.destroy(where: {url: url, project_id: project_id})
.then(() -> cb null)
.error cb
@ -126,7 +122,6 @@ module.exports = UrlCache =
_findAllUrlsInProject: (project_id, callback = (error, urls) ->) ->
job = (cb)->
console.log("_findAllUrlsInProject")
db.UrlCache.findAll(where: { project_id: project_id })
.then(
(urlEntries) ->