// processBatches continually drains the given batcher and writes the batches to the database. func (s *Service) processBatches(batcher *tsdb.PointBatcher) { defer s.wg.Done() for { select { case batch := <-batcher.Out(): if err := s.PointsWriter.WritePoints(&cluster.WritePointsRequest{ Database: s.database, RetentionPolicy: "", ConsistencyLevel: s.consistencyLevel, Points: batch, }); err != nil { s.logger.Printf("failed to write point batch to database %q: %s", s.database, err) } case <-s.done: return } } }
// processBatches continually drains the given batcher and writes the batches to the database. func (s *Service) processBatches(batcher *tsdb.PointBatcher) { defer s.wg.Done() for { select { case batch := <-batcher.Out(): if err := s.PointsWriter.WritePoints(&cluster.WritePointsRequest{ Database: s.database, RetentionPolicy: "", ConsistencyLevel: s.consistencyLevel, Points: batch, }); err == nil { s.statMap.Add(statBatchesTrasmitted, 1) s.statMap.Add(statPointsTransmitted, int64(len(batch))) } else { s.logger.Printf("failed to write point batch to database %q: %s", s.database, err) s.statMap.Add(statBatchesTransmitFail, 1) } case <-s.done: return } } }