Skip to content

Commit

Permalink
fix panic in replay (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Cook authored Jul 18, 2016
1 parent 8fc0603 commit 0ef6c44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

### Bugfixes

- [#710](https://github.com/influxdata/kapacitor/pull/662): Fix infinite loop when parsing unterminated regex in TICKscript.
- [#710](https://github.com/influxdata/kapacitor/pull/710): Fix infinite loop when parsing unterminated regex in TICKscript.
- [#711](https://github.com/influxdata/kapacitor/issue/711): Fix where database name with quotes breaks subscription startup logic.
- [#719](https://github.com/influxdata/kapacitor/pull/719): Fix panic on replay.

## v1.0.0-beta3 [2016-07-09]

Expand Down
9 changes: 8 additions & 1 deletion replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,17 @@ func replayBatchFromChan(clck clock.Clock, batches <-chan models.Batch, collecto
defer collector.Close()

// Find relative times
start := time.Time{}
var start, tmax time.Time
var diff time.Duration
zero := clck.Zero()

for b := range batches {
if len(b.Points) == 0 {
// Emit empty batch
b.TMax = tmax
collector.CollectBatch(b)
continue
}
if start.IsZero() {
start = b.Points[0].Time
diff = zero.Sub(start)
Expand All @@ -193,6 +199,7 @@ func replayBatchFromChan(clck clock.Clock, batches <-chan models.Batch, collecto
}
clck.Until(lastTime)
b.TMax = b.Points[len(b.Points)-1].Time
tmax = b.TMax
collector.CollectBatch(b)
}
return nil
Expand Down

0 comments on commit 0ef6c44

Please sign in to comment.