Fixed formatting and linter errors

This commit is contained in:
Alexandr Krylovskiy
2021-06-26 17:38:58 +02:00
parent 6be645ba24
commit ff5aff8fec
4 changed files with 20 additions and 21 deletions

View File

@@ -19,7 +19,7 @@ type Client struct {
BrokerUser string
BrokerPass string
MsgTopic string
MsgPayload string
MsgPayload string
MsgSize int
MsgCount int
MsgQoS byte
@@ -57,7 +57,7 @@ func (c *Client) Run(res chan *RunResults) {
}
case <-donePub:
// calculate results
duration := time.Now().Sub(started)
duration := time.Since(started)
runResults.MsgTimeMin = stats.StatsMin(times)
runResults.MsgTimeMax = stats.StatsMax(times)
runResults.MsgTimeMean = stats.StatsMean(times)
@@ -77,22 +77,21 @@ func (c *Client) Run(res chan *RunResults) {
func (c *Client) genMessages(ch chan *Message, done chan bool) {
var payload interface{}
// set payload if specified
if c.MsgPayload != "" {
payload = c.MsgPayload
} else {
payload = make([]byte, c.MsgSize)
}
// set payload if specified
if c.MsgPayload != "" {
payload = c.MsgPayload
} else {
payload = make([]byte, c.MsgSize)
}
ch <- &Message{
Topic: c.MsgTopic,
QoS: c.MsgQoS,
Payload: payload,
}
ch <- &Message{
Topic: c.MsgTopic,
QoS: c.MsgQoS,
Payload: payload,
}
done <- true
// log.Printf("CLIENT %v is done generating messages\n", c.ID)
return
}
func (c *Client) pubMessages(in, out chan *Message, doneGen, donePub chan bool) {