diff --git a/database/database.go b/database/database.go index 5e88dc9..12a8034 100644 --- a/database/database.go +++ b/database/database.go @@ -105,7 +105,7 @@ func (db *DB) worker() { } // write batch now? - if bp != nil && (writeNow || closed) || len(bp.Points()) >= batchMaxSize { + if bp != nil && (writeNow || closed || len(bp.Points()) >= batchMaxSize) { log.Println("saving", len(bp.Points()), "points") if err = db.client.Write(bp); err != nil { diff --git a/respond/collector.go b/respond/collector.go index d971b4d..3b6284b 100644 --- a/respond/collector.go +++ b/respond/collector.go @@ -45,6 +45,7 @@ func NewCollector(db *database.DB, nodes *models.Nodes, interval time.Duration, collector := &Collector{ connection: conn, + db: db, nodes: nodes, multicastAddr: net.JoinHostPort(multiCastGroup+"%"+iface, port), queue: make(chan *Response, 400),