Add support to customize leafnode ping_interval (#8718)
Addresses the Leafnodes part of #4991.
What
Adds
ping_intervalandping_maxas options in theleafnodes{}config block, independent from the global settings:leafnodes { port: 7422 ping_interval: '5s' ping_max: 6 }This mirrors the existing route override from #5029 and the existing
websocket.ping_intervaloverride. Split out from the gateway PR to keep each change small and reviewable.How
LeafNodeOpts.PingInterval/LeafNodeOpts.MaxPingsOut(opts.go), parsed inparseLeafNodes.- Wired through the same three call sites the route override uses in client.go:
processPingTimer,setPingTimer,setFirstPingTimer.- No change needed in leafnode.go — unlike gateway/route, leafnode has no direct
watchForStaleConnectioncall site to update.Testing
Added
TestLeafNodeCustomPing, modeled onTestRouteCustomPing. Verified it fails without the client.go wiring (ping never fires within the configured interval) and passes with it. Ran the full leafnode/parse-leaf/ config-check suite locally with no regressions.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
NATS is a simple, secure and performant communications system for digital systems, services and devices. NATS is part of the Cloud Native Computing Foundation (CNCF). NATS has over 40 client language implementations, and its server can run on-premise, in the cloud, at the edge, and even on a Raspberry Pi. NATS can secure and simplify design and operation of modern distributed systems.
Documentation
Contact
Contributing
If you are interested in contributing to NATS, read about our…
Roadmap
The NATS product roadmap can be found here.
Adopters
Who uses NATS? See our list of users on https://nats.io.
Security
Security Audit
A third party security audit was performed by Trail of Bits following engagement by the Open Source Technology Improvement Fund (OSTIF). You can see the full report from April 2025 here.
Reporting Security Vulnerabilities
If you’ve found a vulnerability or a potential vulnerability in the NATS server, please let us know at nats-security.
License
Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.