From 264ae5e425e3c6f90fbea88ad66852a0b5186428 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Sun, 28 Jun 2020 21:50:23 +0100 Subject: run callback in a goroutine --- catbus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catbus.go b/catbus.go index a3eb115..68dee1b 100644 --- a/catbus.go +++ b/catbus.go @@ -106,7 +106,7 @@ func (c *client) Subscribe(topic string, f MessageHandler) error { return c.mqtt.Subscribe(topic, atLeastOnce, func(_ mqtt.Client, msg mqtt.Message) { c.storePayload(msg.Topic(), Retention(msg.Retained()), string(msg.Payload())) - f(c, messageFromMQTTMessage(msg)) + go f(c, messageFromMQTTMessage(msg)) }).Error() } -- cgit v1.2.3