Skip to content

Commit

Permalink
Merge pull request influxdata#309 from influxdata/nc-issue#289
Browse files Browse the repository at this point in the history
batch error handling
  • Loading branch information
Nathaniel Cook committed Mar 10, 2016
2 parents b7a667f + 30d4bf2 commit 1671023
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ With #144 you can now join streams with differing group by dimensions.
- [#270](https://github.com/influxdata/kapacitor/issues/270): The HTTP server will now gracefully stop.
- [#300](https://github.com/influxdata/kapacitor/issues/300): Add OPTIONS method to /recording endpoint for deletes.
- [#304](https://github.com/influxdata/kapacitor/issues/304): Fix panic if recording query but do not have an InfluxDB instance configured
- [#289](https://github.com/influxdata/kapacitor/issues/289): Add better error handling to batch node.

## v0.10.1 [2016-02-08]

Expand Down
17 changes: 12 additions & 5 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ func (b *BatchNode) doQuery() error {
// Connect
con, err := b.et.tm.InfluxDBService.NewClient()
if err != nil {
return err
b.logger.Println("E! failed to connect to InfluxDB:", err)
break
}
q := client.Query{
Command: b.query.String(),
Expand All @@ -271,22 +272,28 @@ func (b *BatchNode) doQuery() error {
// Execute query
resp, err := con.Query(q)
if err != nil {
return err
b.logger.Println("E! query failed:", err)
break
}

if err := resp.Error(); err != nil {
return err
b.logger.Println("E! query failed:", err)
break
}

// Collect batches
for _, res := range resp.Results {
batches, err := models.ResultToBatches(res)
if err != nil {
return err
b.logger.Println("E! failed to understand query result:", err)
continue
}
b.timer.Pause()
for _, bch := range batches {
b.ins[0].CollectBatch(bch)
err := b.ins[0].CollectBatch(bch)
if err != nil {
return err
}
}
b.timer.Resume()
}
Expand Down

0 comments on commit 1671023

Please sign in to comment.