Add support for the sleep duration in requests
@@ -126,14 +126,9 @@ func (c *pubCmd) doReq(nc *nats.Conn, progress *uiprogress.Bar) error {
if c.raw {
fmt.Println(string(m.Data))
- continue
- }
-
- if progress != nil {
+ } else if progress != nil {
progress.Incr()
- continue
- }
-
+ } else {
log.Printf("Received on %q rtt %v", m.Subject, time.Since(start))
if len(m.Header) > 0 {
@@ -152,6 +147,11 @@ func (c *pubCmd) doReq(nc *nats.Conn, progress *uiprogress.Bar) error {
}
}
+ if c.cnt > 1 && c.sleep > 0 {
+ time.Sleep(c.sleep)
+ }
+ }
+
return nil
}
