proposed fix to delete tpds dump files after use

This commit is contained in:
Brian Gough 2015-04-15 14:41:38 +01:00
parent 2ed934120c
commit 396644d314

View file

@ -19,11 +19,16 @@ module.exports =
if element? if element?
elementId = element._id elementId = element._id
self.p.writeStreamToDisk project_id, elementId, updateRequest, (err, fsPath)-> self.p.writeStreamToDisk project_id, elementId, updateRequest, (err, fsPath)->
callback = _.wrap callback, (cb, arg) ->
fs.unlink fsPath, (err) ->
if err?
logger.err project_id:project_id, fsPath:fsPath, "error deleting file"
cb(arg)
return callback(err) if err? return callback(err) if err?
FileTypeManager.isBinary path, fsPath, (err, isFile)-> FileTypeManager.isBinary path, fsPath, (err, isFile)->
return callback(err) if err? return callback(err) if err?
if isFile if isFile
self.p.processFile project_id, elementId, fsPath, path, source, callback #TODO clean up the stream written to disk here self.p.processFile project_id, elementId, fsPath, path, source, callback
else else
self.p.processDoc project_id, elementId, fsPath, path, source, callback self.p.processDoc project_id, elementId, fsPath, path, source, callback