Running a command like nats bench foo.bar --pub 2 --msgs 1 I receive the output:
10:51:24 Starting Core NATS pub/sub benchmark [subject=foo.bar, multisubject=false, multisubjectmax=100000, msgs=1, msgsize=128 B, pubs=2, subs=0, pubsleep=0s, subsleep=0s]
10:51:24 Starting publisher, publishing 1 messages
10:51:24 Starting publisher, publishing 0 messages
panic: runtime error: index out of range [0] with length 0
goroutine 39 [running]:
github.com/gosuri/uiprogress.(*Bar).Bytes(0xc000254000)
/home/giacomo/go/pkg/mod/github.com/gosuri/uiprogress@v0.0.1/bar.go:195 +0x40b
github.com/gosuri/uiprogress.(*Bar).String(...)
/home/giacomo/go/pkg/mod/github.com/gosuri/uiprogress@v0.0.1/bar.go:214
github.com/gosuri/uiprogress.(*Progress).print(0xc0000a2480)
/home/giacomo/go/pkg/mod/github.com/gosuri/uiprogress@v0.0.1/progress.go:127 +0x8f
github.com/gosuri/uiprogress.(*Progress).Listen(0xc0000a2480)
/home/giacomo/go/pkg/mod/github.com/gosuri/uiprogress@v0.0.1/progress.go:116 +0xb3
created by github.com/gosuri/uiprogress.(*Progress).Start in goroutine 1
/home/giacomo/go/pkg/mod/github.com/gosuri/uiprogress@v0.0.1/progress.go:134 +0x4f
Expected behavior
To prevent a runtime error when the number of messages for a publisher is zero, the progress bar could be shown as already completed instead of attempting to update it. A possible solution:
Observed behavior
Running a command like
nats bench foo.bar --pub 2 --msgs 1
I receive the output:Expected behavior
To prevent a runtime error when the number of messages for a publisher is zero, the progress bar could be shown as already completed instead of attempting to update it. A possible solution:
File: https://github.com/nats-io/natscli/blob/main/cli/bench_command.go#L1718
Server and client version
NATS server:
2.10.20
CLI client:v0.1.5
Host environment
No response
Steps to reproduce
No response