reduce logging
This commit is contained in:
@@ -2,7 +2,6 @@ async = require "async"
|
|||||||
Settings = require "settings-sharelatex"
|
Settings = require "settings-sharelatex"
|
||||||
|
|
||||||
queue = async.queue((task, cb)->
|
queue = async.queue((task, cb)->
|
||||||
console.log("running task")
|
|
||||||
task(cb)
|
task(cb)
|
||||||
, Settings.parallelSqlQueryLimit)
|
, Settings.parallelSqlQueryLimit)
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ module.exports = DockerRunner =
|
|||||||
fingerprint = DockerRunner._fingerprintContainer(options)
|
fingerprint = DockerRunner._fingerprintContainer(options)
|
||||||
options.name = name = "project-#{project_id}-#{fingerprint}"
|
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) ->
|
DockerRunner._runAndWaitForContainer options, volumes, timeout, (error, output) ->
|
||||||
if error?.message?.match("HTTP code is 500")
|
if error?.message?.match("HTTP code is 500")
|
||||||
logger.log err: error, project_id: project_id, "error running container so destroying and retrying"
|
logger.log err: error, project_id: project_id, "error running container so destroying and retrying"
|
||||||
@@ -145,13 +147,13 @@ module.exports = DockerRunner =
|
|||||||
"CapDrop": "ALL"
|
"CapDrop": "ALL"
|
||||||
"SecurityOpt": ["no-new-privileges"]
|
"SecurityOpt": ["no-new-privileges"]
|
||||||
|
|
||||||
if Settings.clsi.docker.seccomp_profile?
|
|
||||||
options.HostConfig.SecurityOpt.push "seccomp=#{Settings.clsi.docker.seccomp_profile}"
|
|
||||||
|
|
||||||
if Settings.path?.synctexBinHostPath?
|
if Settings.path?.synctexBinHostPath?
|
||||||
options["HostConfig"]["Binds"].push("#{Settings.path.synctexBinHostPath}:/opt/synctex:ro")
|
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
|
return options
|
||||||
|
|
||||||
_fingerprintContainer: (containerOptions) ->
|
_fingerprintContainer: (containerOptions) ->
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ module.exports = ProjectPersistenceManager =
|
|||||||
|
|
||||||
markProjectAsJustAccessed: (project_id, callback = (error) ->) ->
|
markProjectAsJustAccessed: (project_id, callback = (error) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
console.log("markProjectAsJustAccessed")
|
|
||||||
db.Project.findOrCreate(where: {project_id: project_id})
|
db.Project.findOrCreate(where: {project_id: project_id})
|
||||||
.spread(
|
.spread(
|
||||||
(project, created) ->
|
(project, created) ->
|
||||||
@@ -59,7 +58,6 @@ module.exports = ProjectPersistenceManager =
|
|||||||
|
|
||||||
_clearProjectFromDatabase: (project_id, callback = (error) ->) ->
|
_clearProjectFromDatabase: (project_id, callback = (error) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
console.log("_clearProjectFromDatabase")
|
|
||||||
db.Project.destroy(where: {project_id: project_id})
|
db.Project.destroy(where: {project_id: project_id})
|
||||||
.then(() -> cb())
|
.then(() -> cb())
|
||||||
.error cb
|
.error cb
|
||||||
@@ -69,7 +67,6 @@ module.exports = ProjectPersistenceManager =
|
|||||||
_findExpiredProjectIds: (callback = (error, project_ids) ->) ->
|
_findExpiredProjectIds: (callback = (error, project_ids) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
keepProjectsFrom = new Date(Date.now() - ProjectPersistenceManager.EXPIRY_TIMEOUT)
|
keepProjectsFrom = new Date(Date.now() - ProjectPersistenceManager.EXPIRY_TIMEOUT)
|
||||||
console.log("_findExpiredProjectIds", keepProjectsFrom)
|
|
||||||
q = {}
|
q = {}
|
||||||
q[db.op.gt] = keepProjectsFrom
|
q[db.op.gt] = keepProjectsFrom
|
||||||
db.Project.findAll(where:{lastAccessed:q})
|
db.Project.findAll(where:{lastAccessed:q})
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ module.exports = UrlCache =
|
|||||||
_doesUrlNeedDownloading: (project_id, url, lastModified, callback = (error, needsDownloading) ->) ->
|
_doesUrlNeedDownloading: (project_id, url, lastModified, callback = (error, needsDownloading) ->) ->
|
||||||
if !lastModified?
|
if !lastModified?
|
||||||
return callback null, true
|
return callback null, true
|
||||||
console.log "about to get _findUrlDetails"
|
|
||||||
UrlCache._findUrlDetails project_id, url, (error, urlDetails) ->
|
UrlCache._findUrlDetails project_id, url, (error, urlDetails) ->
|
||||||
console.log error, urlDetails, "_findUrlDetails result"
|
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
if !urlDetails? or !urlDetails.lastModified? or urlDetails.lastModified.getTime() < lastModified.getTime()
|
if !urlDetails? or !urlDetails.lastModified? or urlDetails.lastModified.getTime() < lastModified.getTime()
|
||||||
return callback null, true
|
return callback null, true
|
||||||
@@ -104,7 +102,6 @@ module.exports = UrlCache =
|
|||||||
|
|
||||||
_updateOrCreateUrlDetails: (project_id, url, lastModified, callback = (error) ->) ->
|
_updateOrCreateUrlDetails: (project_id, url, lastModified, callback = (error) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
console.log("_updateOrCreateUrlDetails")
|
|
||||||
db.UrlCache.findOrCreate(where: {url: url, project_id: project_id})
|
db.UrlCache.findOrCreate(where: {url: url, project_id: project_id})
|
||||||
.spread(
|
.spread(
|
||||||
(urlDetails, created) ->
|
(urlDetails, created) ->
|
||||||
@@ -117,7 +114,6 @@ module.exports = UrlCache =
|
|||||||
|
|
||||||
_clearUrlDetails: (project_id, url, callback = (error) ->) ->
|
_clearUrlDetails: (project_id, url, callback = (error) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
console.log("_clearUrlDetails")
|
|
||||||
db.UrlCache.destroy(where: {url: url, project_id: project_id})
|
db.UrlCache.destroy(where: {url: url, project_id: project_id})
|
||||||
.then(() -> cb null)
|
.then(() -> cb null)
|
||||||
.error cb
|
.error cb
|
||||||
@@ -126,7 +122,6 @@ module.exports = UrlCache =
|
|||||||
|
|
||||||
_findAllUrlsInProject: (project_id, callback = (error, urls) ->) ->
|
_findAllUrlsInProject: (project_id, callback = (error, urls) ->) ->
|
||||||
job = (cb)->
|
job = (cb)->
|
||||||
console.log("_findAllUrlsInProject")
|
|
||||||
db.UrlCache.findAll(where: { project_id: project_id })
|
db.UrlCache.findAll(where: { project_id: project_id })
|
||||||
.then(
|
.then(
|
||||||
(urlEntries) ->
|
(urlEntries) ->
|
||||||
|
|||||||
Reference in New Issue
Block a user