Beispiel #1
0
func write_in_batches(data []string, client *client.Client, size int, db string, wg *sync.WaitGroup) {
	start := time.Now()
	n := len(data)
	for index := 0; index < n; {
		end := index + size
		if end >= n {
			end = n - 1
		}
		txt := strings.Join(data[index:end], "\n")
		_, err := client.WriteLineProtocol(txt, db, "", "", "")
		if err != nil {
			panic(err)
		}
		index = index + size
	}
	seelog.Infof("Write done in %s", time.Since(start))
	wg.Done()

}