Skip to content

Commit

Permalink
Merge pull request #135 from winebarrel/fix_unlimited_rate
Browse files Browse the repository at this point in the history
Fix unlimited rate option
  • Loading branch information
winebarrel authored Nov 1, 2024
2 parents b2a3a43 + 0d337cf commit 3c60153
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# Changelog

<!--
## [Unreleased]
* N/A
-->

## [1.2.1] - 2024-11-01

### Fixed

- Fix unlimited rate (`-r 0`) option.

## [1.2.0] - 2024-10-31

### Changed

- Supports multiple data files.

## [1.1.0] - 2024-08-29

### Added

- Add "--color" option.

## [1.0.4] - 2023-11-27

Expand Down
7 changes: 6 additions & 1 deletion task.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ func NewTask(options *Options) *Task {
func (task *Task) makeAgents() ([]*Agent, *Recorder, error) {
agents := make([]*Agent, task.Nagents)
rec := NewRecorder(task.ID, task.Options)
limiter := rate.NewLimiter(rate.Limit(task.Rate), 1)

var limiter *rate.Limiter

if task.Rate > 0 {
limiter = rate.NewLimiter(rate.Limit(task.Rate), 1)
}

for i := uint64(0); i < task.Nagents; i++ {
var err error
Expand Down

0 comments on commit 3c60153

Please sign in to comment.