fix lock releasing in mqtt client on error

This commit is contained in:
Joel Wetzell
2026-08-11 19:58:33 -05:00
parent a1f7bca743
commit 7c0a504616
+1 -1
View File
@@ -148,13 +148,13 @@ func (mc *MQTTClient) Start(ctx context.Context, inputHandler common.InputHandle
mc.client = mqtt.NewClient(opts)
token := mc.client.Connect()
mc.clientMu.Unlock()
token.Wait()
err := token.Error()
if err != nil {
return err
}
mc.clientMu.Unlock()
<-mc.ctx.Done()
mc.logger.Debug("done")