Skip to content

Commit

Permalink
Use buffered channel for appending chart values (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Oct 25, 2020
1 parent a30c166 commit 7660e9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions gui/drawer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ type drawer struct {
metricsCh chan *attacker.Metrics
doneCh chan struct{}

chartValues values
metrics *attacker.Metrics

// aims to avoid to perform multiple `appendChartValues`.
chartDrawing *atomic.Bool

mu sync.RWMutex
mu sync.RWMutex
chartValues values
metrics *attacker.Metrics
}

type values struct {
Expand Down
2 changes: 1 addition & 1 deletion gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func run(t terminalapi.Terminal, r runner, targetURL string, opts *attacker.Opti
d := &drawer{
widgets: w,
gridOpts: gridOpts,
chartCh: make(chan *attacker.Result),
chartCh: make(chan *attacker.Result, 10000),
gaugeCh: make(chan struct{}),
metricsCh: make(chan *attacker.Metrics),
chartDrawing: atomic.NewBool(false),
Expand Down

0 comments on commit 7660e9d

Please sign in to comment.