• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EvergenEnergy / sparkplug-host / 29222541534
85%

Build:
DEFAULT BRANCH: main
Ran 13 Jul 2026 03:51AM UTC
Jobs 1
Files 9
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Jul 2026 03:50AM UTC coverage: 85.27% (-0.02%) from 85.285%
29222541534

push

github

web-flow
fix: set MQTT write timeout so AutoReconnect recovers from half-open connections (#48)

* fix: set MQTT write timeout so AutoReconnect recovers from half-open connections

paho's AutoReconnect only fires after the client observes ConnectionLost. On
a half-open TCP connection (e.g. broker recreated behind a proxy/sidecar with
no RST reaching the client) the keepalive PING is a socket write, and with
paho's default of no write timeout that write blocks forever on the dead
socket. ConnectionLost is never reported, AutoReconnect never fires, and the
host application sits silently disconnected.

Set a default MQTT write timeout (10s) and an explicit keepalive (30s, paho's
default) in initClients() so a stalled PING fails and the lost connection is
surfaced for AutoReconnect to recover. Both are configurable via the new
WithMqttWriteTimeout and WithMqttKeepAlive options; WithMqttWriteTimeout(0)
restores the previous blocking behaviour.

* feat: add WithMqttPingTimeout and correct write-timeout mechanism docs

Addresses review feedback on the write-timeout mechanism:

- Correct the doc comments: in paho v1.5.1 WriteTimeout is applied only to
  outbound application writes in the outgoing worker (net.go SetWriteDeadline),
  NOT to the keepalive PING (ping.go writes it with no deadline). The real
  benefit is unsticking a blocked outbound write on a half-open connection whose
  send buffer has filled (which can also stall the keepalive goroutine and stop
  the ping-timeout check from running). Reworded options.go and host.go
  accordingly.
- Add WithMqttPingTimeout: for an idle half-open connection the small PINGREQ is
  written without blocking and detection is governed by the ping timeout, so
  expose it as the knob for idle-detection latency. Default 10s (paho default).
- Document the WithMqttKeepAlive(0) footgun: paho stores keepalive as whole
  seconds, so sub-second truncates to 0 and 0 disables keepalive entirely.
- Add an internal test that calls initCl... (continued)

34 of 34 new or added lines in 2 files covered. (100.0%)

5 existing lines in 1 file now uncovered.

822 of 964 relevant lines covered (85.27%)

38.17 hits per line

Coverage Regressions

Lines Coverage ∆ File
5
73.76
-0.89% host.go
Jobs
ID Job ID Ran Files Coverage
1 29222541534.1 13 Jul 2026 03:51AM UTC 9
85.27
GitHub Action Run
Source Files on build 29222541534
  • Tree
  • List 9
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • cd775fc7 on github
  • Prev Build on main (#28986100955)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc