Unverified Commit 69ba0766 authored by fancar's avatar fancar Committed by GitHub
Browse files

mqtt eventHandler: run packet handlers as goroutines to avoid the entire paho...

mqtt eventHandler: run packet handlers as goroutines to avoid the entire paho blocking while chosen handler in process (#564)
parent 05175157
......@@ -203,13 +203,13 @@ func (b *Backend) eventHandler(c paho.Client, msg paho.Message) {
if strings.HasSuffix(msg.Topic(), "up") {
mqttEventCounter("up").Inc()
b.rxPacketHandler(c, msg)
go b.rxPacketHandler(c, msg)
} else if strings.HasSuffix(msg.Topic(), "ack") {
mqttEventCounter("ack").Inc()
b.ackPacketHandler(c, msg)
go b.ackPacketHandler(c, msg)
} else if strings.HasSuffix(msg.Topic(), "stats") {
mqttEventCounter("stats").Inc()
b.statsPacketHandler(c, msg)
go b.statsPacketHandler(c, msg)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment