Skip to content

Commit

Permalink
Support zero rate, improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Brophy committed Dec 2, 2017
1 parent 59589bb commit 73a8be4
Show file tree
Hide file tree
Showing 8 changed files with 485 additions and 195 deletions.
9 changes: 5 additions & 4 deletions blaster/blaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ type Blaster struct {
payloadRenderer renderer
workerRenderer renderer

mainChannel chan struct{}
mainChannel chan int
errorChannel chan error
workerChannel chan workDef
logChannel chan logRecord
dataFinishedChannel chan struct{}
workersFinishedChannel chan struct{}
itemFinishedChannel chan struct{}
changeRateChannel chan float64
signalChannel chan os.Signal

Expand Down Expand Up @@ -157,7 +158,7 @@ func New(ctx context.Context, cancel context.CancelFunc) *Blaster {
changeRateChannel: make(chan float64, 1),
errorChannel: make(chan error),
logChannel: make(chan logRecord),
mainChannel: make(chan struct{}),
mainChannel: make(chan int),
workerChannel: make(chan workDef),
Rate: 10,
Workers: 10,
Expand Down Expand Up @@ -252,8 +253,8 @@ func (b *Blaster) Start(ctx context.Context) (Summary, error) {
panic("Must specify workers!")
}

if b.Rate <= 0 {
panic("Must specify rate!")
if b.Rate < 0 {
panic("Rate must not be negative!")
}

err := b.start(ctx)
Expand Down
Loading

0 comments on commit 73a8be4

Please sign in to comment.