Skip to content

Commit

Permalink
Merge pull request #26 from josephcopenhaver/develop
Browse files Browse the repository at this point in the history
Bugfix: deadlock due to recent bad refactor
  • Loading branch information
josephcopenhaver authored Oct 18, 2024
2 parents b670e68 + 44f01c7 commit d80d699
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 38 deletions.
19 changes: 8 additions & 11 deletions loadtester/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,14 @@ func main() {
//

// define input handling channel and closer
inputChan := make(chan string)
closeInputChan := func() func() {
var once sync.Once
inputChan, closeInputChan := func() (chan string, func()) {
c := make(chan string)

c := inputChan
closer := sync.OnceFunc(func() {
close(c)
})

return func() {
once.Do(func() {
close(c)
})
}
return c, closer
}()

//
Expand Down Expand Up @@ -169,7 +166,7 @@ func main() {

// note it's possible for this channel
// write to panic due to the user
// doing thing really fast and pressing control-c afterward
// doing things really fast and pressing control-c afterward
//
// but in that case we're still going through the stop procedure so meh

Expand All @@ -190,7 +187,7 @@ func main() {
// single outlier task affects the throughput of all the others in the same interval-segment of time.

switch s {
case "stop":
case "stop", "exit", "quit":
return
case "set workers":
cu.SetNumWorkers(numWorkers)
Expand Down
72 changes: 48 additions & 24 deletions loadtester/gen_strategies.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d80d699

Please sign in to comment.