diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-12-04 16:14:34 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-12-04 16:14:34 -0500 |
| commit | fe180581bde9a0bdb79fd9a8d801701982afa2ff (patch) | |
| tree | a08129c828868a7a3bfc0edf1f8c213a478fc2bd /lib/zclient.c | |
| parent | 267dc19825eb1e5281fd6f6990bf0ee7c4664604 (diff) | |
lib: Speed up reconnection attempts for zapi
Currently the zapi reconnection is once every 10 seconds
for the first 3 times and then once every 60 seconds from then
on out. We are seeing interesting behavior under loaded systems
where zebra is just slow to come up and daemons are spending a long
time waiting to connect. Let's just make things a bit more aggressive.
Change the code to attempt to reconnect once every second for 30 seconds
and then change to once every 5 seconds from then on out.
This should help with non-integrated configuration on system startup.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 557d9c3eb9..063944fd3b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -4693,6 +4693,9 @@ void zclient_redistribute_default(int command, struct zclient *zclient, zebra_redistribute_default_send(command, zclient, afi, vrf_id); } +#define ZCLIENT_QUICK_RECONNECT 1 +#define ZCLIENT_SLOW_RECONNECT 5 +#define ZCLIENT_SWITCH_TO_SLOW 30 static void zclient_event(enum zclient_event event, struct zclient *zclient) { switch (event) { @@ -4702,11 +4705,13 @@ static void zclient_event(enum zclient_event event, struct zclient *zclient) break; case ZCLIENT_CONNECT: if (zclient_debug) - zlog_debug( - "zclient connect failures: %d schedule interval is now %d", - zclient->fail, zclient->fail < 3 ? 10 : 60); + zlog_debug("zclient connect failures: %d schedule interval is now %d", + zclient->fail, + zclient->fail < ZCLIENT_SWITCH_TO_SLOW ? ZCLIENT_QUICK_RECONNECT + : ZCLIENT_SLOW_RECONNECT); event_add_timer(zclient->master, zclient_connect, zclient, - zclient->fail < 3 ? 10 : 60, + zclient->fail < ZCLIENT_SWITCH_TO_SLOW ? ZCLIENT_QUICK_RECONNECT + : ZCLIENT_SLOW_RECONNECT, &zclient->t_connect); break; case ZCLIENT_READ: |
