]> git.aero2k.de Git - urlbot-v3.git/commit
Fix NATS reconnect handling: retry forever instead of giving up after ~2min
authorThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 07:45:07 +0000 (09:45 +0200)
committerThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 07:45:07 +0000 (09:45 +0200)
commit1c10b7e7dbbeba0524bfe1f589d9c60821b2308b
treef979363e84c11d2a92daccf941ee383f0d421951
parentb82ee8602c4c262f00d8373e236ac201b0bdf6a8
Fix NATS reconnect handling: retry forever instead of giving up after ~2min

nats-py's default max_reconnect_attempts (60 * 2s) meant a long-enough NATS
outage would leave worker.py's per-plugin consumer threads permanently
stuck with no recovery path - unlike the AsyncBroker path used by
action_worker.py, they had no closed_cb to notice and react to a permanent
disconnect. Setting max_reconnect_attempts=-1 makes nats-py retry
indefinitely instead; confirmed via a local test that a plugin thread
survives a NATS restart and resumes receiving messages afterward without
any restart of its own. Also bumps connect_timeout from nats-py's 2s
default to 10s, since munin (a Pi Zero-class host) observed transient
connect timeouts when ~40 plugin threads dialed in simultaneously at
startup under the tighter default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src/distbot/common/broker_nats.py