influx-sink.js
function on_write (metric, enc, done) {
  var name = metric.name
  var values = metric.values
  var tags = metric.tags

  locals.batch.list[name] = locals.batch.list[name] || []
  locals.batch.list[name].push([values, tags])
  locals.batch.count = locals.batch.count + 1

  var exceeded = locals.batch.count >= locals.batch.max
  var expired = Date.now() > locals.batch.next

  if (exceeded || expired) {
    write_batch()
  }

  done()
}
function on_write (metric, enc, done) {
  var name = metric.name
  var values = metric.values
  var tags = metric.tags

  locals.batch.list[name] = locals.batch.list[name] || []
  locals.batch.list[name].push([values, tags])
  locals.batch.count = locals.batch.count + 1

  var exceeded = locals.batch.count >= locals.batch.max
  var expired = Date.now() > locals.batch.next

  if (exceeded || expired) {
    write_batch()
  }

  done()
}
function on_write ( metric , enc , done ) { var name = metric . name var values = metric . values var tags = metric . tags locals . batch . list [ name ] = locals . batch . list [ name ] || [ ] locals . batch . list [ name ] . push ( [ values , tags ] ) locals . batch . count = locals . batch . count + 1 var exceeded = locals . batch . count >= locals . batch . max var expired = Date . now ( ) > locals . batch . next if ( exceeded || expired ) { write_batch ( ) } done ( ) }
Called each time the stream is written to
Called each time the stream is written to