Move tpds worker error ignoring logic into tpdsUpdateSender

This commit is contained in:
James Allen 2017-04-11 15:41:17 +01:00
parent 7c8f228f48
commit 6d2f18016f
2 changed files with 6 additions and 11 deletions

View file

@ -138,8 +138,7 @@ module.exports = ProjectEntityHandler =
project_name: project.name, project_name: project.name,
rev: 0 rev: 0
}, (err) -> }, (err) ->
if err? return callback(err) if err?
logger.err err:err, "error adding doc to tpdsworker, contining anyway"
callback(null, doc, folder_id) callback(null, doc, folder_id)
restoreDoc: (project_id, doc_id, name, callback = (error, doc, folder_id) ->) -> restoreDoc: (project_id, doc_id, name, callback = (error, doc, folder_id) ->) ->
@ -170,9 +169,8 @@ module.exports = ProjectEntityHandler =
if err? if err?
logger.err err:err, project_id: project._id, folder_id: folder_id, file_name: fileName, fileRef:fileRef, "error adding file with project" logger.err err:err, project_id: project._id, folder_id: folder_id, file_name: fileName, fileRef:fileRef, "error adding file with project"
return callback(err) return callback(err)
tpdsUpdateSender.addFile {project_id:project._id, file_id:fileRef._id, path:result?.path?.fileSystem, project_name:project.name, rev:fileRef.rev}, (err)-> tpdsUpdateSender.addFile {project_id:project._id, file_id:fileRef._id, path:result?.path?.fileSystem, project_name:project.name, rev:fileRef.rev}, (err) ->
if err? return callback(err) if err?
logger.err err:err, project_id: project._id, folder_id: folder_id, file_name: fileName, fileRef:fileRef, "error sending file to tpdsworker"
callback(null, fileRef, folder_id) callback(null, fileRef, folder_id)
replaceFile: (project_id, file_id, fsPath, callback)-> replaceFile: (project_id, file_id, fsPath, callback)->
@ -315,10 +313,7 @@ module.exports = ProjectEntityHandler =
if modified if modified
# Don't need to block for marking as updated # Don't need to block for marking as updated
projectUpdateHandler.markAsUpdated project_id projectUpdateHandler.markAsUpdated project_id
tpdsUpdateSender.addDoc {project_id:project_id, path:path.fileSystem, doc_id:doc_id, project_name:project.name, rev:rev}, (error) -> tpdsUpdateSender.addDoc {project_id:project_id, path:path.fileSystem, doc_id:doc_id, project_name:project.name, rev:rev}, callback
if error?
logger.err {err: error, project_id, doc_id, version}, "error sending doc to tpds, but continuing"
callback()
else else
callback() callback()

View file

@ -35,8 +35,8 @@ module.exports = TpdsUpdateSender =
timeout: (5 * 1000) timeout: (5 * 1000)
request opts, (err)-> request opts, (err)->
if err? if err?
logger.err err:err, "error queuing something in the tpdsworker" logger.err err:err, "error queuing something in the tpdsworker, continuing anyway"
callback(err) callback()
else else
logger.log group:group, "successfully queued up job for tpdsworker" logger.log group:group, "successfully queued up job for tpdsworker"
callback() callback()