Explorar o código

move pipe after error handler setup

Brian Gough %!s(int64=11) %!d(string=hai) anos
pai
achega
8ebbacee5a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      services/filestore/app/coffee/LocalFileWriter.coffee

+ 1 - 1
services/filestore/app/coffee/LocalFileWriter.coffee

@@ -14,7 +14,6 @@ module.exports =
 		fsPath = @_getPath(key)
 		fsPath = @_getPath(key)
 		logger.log fsPath:fsPath, "writing file locally"
 		logger.log fsPath:fsPath, "writing file locally"
 		writeStream = fs.createWriteStream(fsPath)
 		writeStream = fs.createWriteStream(fsPath)
-		stream.pipe writeStream
 		writeStream.on "finish", ->
 		writeStream.on "finish", ->
 			timer.done()
 			timer.done()
 			logger.log fsPath:fsPath, "finished writing file locally"
 			logger.log fsPath:fsPath, "finished writing file locally"
@@ -25,6 +24,7 @@ module.exports =
 		stream.on "error", (err)->
 		stream.on "error", (err)->
 			logger.log err:err, fsPath:fsPath, "problem writing file locally, with read stream"
 			logger.log err:err, fsPath:fsPath, "problem writing file locally, with read stream"
 			callback err
 			callback err
+		stream.pipe writeStream
 
 
 	deleteFile: (fsPath, callback)->
 	deleteFile: (fsPath, callback)->
 		logger.log fsPath:fsPath, "removing local temp file"
 		logger.log fsPath:fsPath, "removing local temp file"