Skip to content

Commit

Permalink
fix panic during replays
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Nov 16, 2016
1 parent 41738bd commit 01f3409
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ stream

### Bugfixes

- [#1045](https://github.com/influxdata/kapacitor/issues/1045): Fix panic during replays.



## v1.1.0 [2016-10-07]
Expand Down
10 changes: 10 additions & 0 deletions edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type BatchCollector interface {
}

type Edge struct {
mu sync.Mutex
closed bool

stream chan models.Point
batch chan models.Batch

Expand Down Expand Up @@ -108,7 +111,14 @@ func (e *Edge) readGroupStats(f func(group models.GroupID, collected, emitted in

// Close the edge, this can only be called after all
// collect calls to the edge have finished.
// Can be called multiple times.
func (e *Edge) Close() {
e.mu.Lock()
defer e.mu.Unlock()
if e.closed {
return
}
e.closed = true
e.logger.Printf(
"D! closing c: %d e: %d\n",
e.collected.IntValue(),
Expand Down

0 comments on commit 01f3409

Please sign in to comment.