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

Commit

Permalink
Delete views from measure ref when unregistering (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-mi authored Jun 4, 2020
1 parent cd9ae5c commit 785d899
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions stats/view/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,13 @@ func (w *worker) tryRegisterView(v *View) (*viewInternal, error) {
return vi, nil
}

func (w *worker) unregisterView(viewName string) {
func (w *worker) unregisterView(v *viewInternal) {
w.mu.Lock()
defer w.mu.Unlock()
delete(w.views, viewName)
delete(w.views, v.view.Name)
if measure := w.measures[v.view.Measure.Name()]; measure != nil {
delete(measure.views, v)
}
}

func (w *worker) reportView(v *viewInternal, now time.Time) {
Expand Down
2 changes: 1 addition & 1 deletion stats/view/worker_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (cmd *unregisterFromViewReq) handleCommand(w *worker) {
// The collected data can be cleared.
vi.clearRows()
}
w.unregisterView(name)
w.unregisterView(vi)
}
cmd.done <- struct{}{}
}
Expand Down

0 comments on commit 785d899

Please sign in to comment.