Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
fix: don't copy waitgroup, h.Source can't be printed as string
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Jan 6, 2017
1 parent ac71309 commit e4272c2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/mt-index-migrate-050-to-054/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ func main() {
log.Fatalf("failed to create cql session. %s", err)
}
wg.Add(1)
go writeDefs(session, defsChan, wg)
go writeDefs(session, defsChan, &wg)

conn := elastigo.NewConn()
conn.SetHosts([]string{*esAddr})
wg.Add(1)
go getDefs(conn, defsChan, wg)
go getDefs(conn, defsChan, &wg)

wg.Wait()

}

func writeDefs(session *gocql.Session, defsChan chan *schema.MetricDefinition, wg sync.WaitGroup) {
func writeDefs(session *gocql.Session, defsChan chan *schema.MetricDefinition, wg *sync.WaitGroup) {
defer wg.Done()
data := make([]byte, 0)
for def := range defsChan {
Expand Down Expand Up @@ -96,7 +96,7 @@ func writeDefs(session *gocql.Session, defsChan chan *schema.MetricDefinition, w
log.Printf("defsWriter exiting.")
}

func getDefs(conn *elastigo.Conn, defsChan chan *schema.MetricDefinition, wg sync.WaitGroup) {
func getDefs(conn *elastigo.Conn, defsChan chan *schema.MetricDefinition, wg *sync.WaitGroup) {
defer wg.Done()
defer close(defsChan)
var err error
Expand All @@ -115,7 +115,7 @@ func getDefs(conn *elastigo.Conn, defsChan chan *schema.MetricDefinition, wg syn
for _, h := range out.Hits.Hits {
mdef, err := schemaV0.MetricDefinitionFromJSON(*h.Source)
if err != nil {
log.Printf("Error: Bad definition in index. %s - %s", h.Source, err)
log.Printf("Error: Bad definition in index. %v - %s", h.Source, err)
continue
}
newDef := &schema.MetricDefinition{
Expand Down

0 comments on commit e4272c2

Please sign in to comment.