pause stream while writing to mongo

This commit is contained in:
Brian Gough 2015-09-16 15:32:36 +01:00
parent 70200a9cf1
commit dfa0036507

View file

@ -57,7 +57,9 @@ module.exports = MongoAWS =
if line.length > 2
ops.push(JSON.parse(line))
if ops.length == MongoAWS.bulkLimit
download.pause()
MongoAWS.handleBulk ops.slice(0), () ->
download.resume()
ops.splice(0,ops.length)
.on 'end', () ->
MongoAWS.handleBulk ops, callback