mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
Merge pull request #58 from sharelatex/bg-increase-incremental-logging
log all errors in getProjectDocs
This commit is contained in:
commit
07c46e8248
1 changed files with 14 additions and 5 deletions
|
@ -65,12 +65,16 @@ module.exports = ProjectManager =
|
||||||
_callback(args...)
|
_callback(args...)
|
||||||
|
|
||||||
RedisManager.checkOrSetProjectState project_id, projectStateHash, (error, projectStateChanged) ->
|
RedisManager.checkOrSetProjectState project_id, projectStateHash, (error, projectStateChanged) ->
|
||||||
return callback(error) if error?
|
if error?
|
||||||
|
logger.error err: error, project_id: project_id, "error getting/setting project state in getProjectDocs"
|
||||||
|
return callback(error)
|
||||||
# we can't return docs if project structure has changed
|
# we can't return docs if project structure has changed
|
||||||
return callback Errors.ProjectStateChangedError("project state changed") if projectStateChanged
|
return callback Errors.ProjectStateChangedError("project state changed") if projectStateChanged
|
||||||
# project structure hasn't changed, return doc content from redis
|
# project structure hasn't changed, return doc content from redis
|
||||||
RedisManager.getDocIdsInProject project_id, (error, doc_ids) ->
|
RedisManager.getDocIdsInProject project_id, (error, doc_ids) ->
|
||||||
return callback(error) if error?
|
if error?
|
||||||
|
logger.error err: error, project_id: project_id, "error getting doc ids in getProjectDocs"
|
||||||
|
return callback(error)
|
||||||
jobs = []
|
jobs = []
|
||||||
docs = []
|
docs = []
|
||||||
for doc_id in doc_ids or []
|
for doc_id in doc_ids or []
|
||||||
|
@ -79,18 +83,23 @@ module.exports = ProjectManager =
|
||||||
# check the doc version first
|
# check the doc version first
|
||||||
RedisManager.getDocVersion doc_id, (error, version) ->
|
RedisManager.getDocVersion doc_id, (error, version) ->
|
||||||
if error?
|
if error?
|
||||||
logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc version"
|
logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc version in getProjectDocs"
|
||||||
return cb(error)
|
return cb(error)
|
||||||
# skip getting the doc if we already have that version
|
# skip getting the doc if we already have that version
|
||||||
return cb() if version? and version is excludeVersions[doc_id]
|
if version? and version is excludeVersions[doc_id]
|
||||||
|
# not currently using excludeVersions so we shouldn't get here!
|
||||||
|
# change to logger.log when this code path is in use
|
||||||
|
logger.error err: error, project_id: project_id, doc_id: doc_id, version: version, "skipping doc version in getProjectDocs"
|
||||||
|
return cb()
|
||||||
# otherwise get the doc lines from redis
|
# otherwise get the doc lines from redis
|
||||||
RedisManager.getDocLines doc_id, (error, lines) ->
|
RedisManager.getDocLines doc_id, (error, lines) ->
|
||||||
if error?
|
if error?
|
||||||
logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc lines"
|
logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc lines in getProjectDocs"
|
||||||
return cb(error)
|
return cb(error)
|
||||||
try
|
try
|
||||||
docs.push {_id: doc_id, lines: JSON.parse(lines), v: version}
|
docs.push {_id: doc_id, lines: JSON.parse(lines), v: version}
|
||||||
catch e
|
catch e
|
||||||
|
logger.error err: e, project_id: project_id, doc_id: doc_id, lines: lines, version: version, "error parsing doc lines in getProjectDocs"
|
||||||
return cb(e)
|
return cb(e)
|
||||||
cb()
|
cb()
|
||||||
async.series jobs, (error) ->
|
async.series jobs, (error) ->
|
||||||
|
|
Loading…
Reference in a new issue