From 00c6cb23332723d87635b26bf12ec5aed1bf6c15 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 1 Aug 2026 19:58:47 +0200 Subject: [PATCH] libsrx: promote SYSREPO_TIMEOUT to srx/common.h The 60 second timeout for datastore operations was defined locally in test-mode, and hard-coded in confd's factory reset RPC. Make it available to all services. Signed-off-by: Joachim Wiberg --- src/confd/src/factory.c | 2 +- src/libsrx/src/common.h | 6 ++++++ src/test-mode/src/test-mode.c | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/confd/src/factory.c b/src/confd/src/factory.c index 283aa1dc..450163e9 100644 --- a/src/confd/src/factory.c +++ b/src/confd/src/factory.c @@ -23,7 +23,7 @@ static int rpc(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, DEBUG("%s", xpath); sr_session_switch_ds(session, SR_DS_RUNNING); - rc = sr_copy_config(session, NULL, SR_DS_FACTORY_DEFAULT, 60000); + rc = sr_copy_config(session, NULL, SR_DS_FACTORY_DEFAULT, SYSREPO_TIMEOUT); if (rc) { sr_session_set_netconf_error(session, "application", "operation-failed", NULL, xpath, sr_strerror(rc), 0); diff --git a/src/libsrx/src/common.h b/src/libsrx/src/common.h index cb6fdaab..a336490e 100644 --- a/src/libsrx/src/common.h +++ b/src/libsrx/src/common.h @@ -10,6 +10,12 @@ extern int debug; +/* + * Default timeout (ms) for sysrepo operations, same as our frontends. + * Use instead of 0 -- callbacks may be starved out on loaded systems. + */ +#define SYSREPO_TIMEOUT 60000 + /* In IETF referred to LOG_AUDIT */ #ifndef LOG_AUDIT #define LOG_AUDIT (13<<3) /* Log audit, for audit trails */ diff --git a/src/test-mode/src/test-mode.c b/src/test-mode/src/test-mode.c index ac197d88..1db989b2 100644 --- a/src/test-mode/src/test-mode.c +++ b/src/test-mode/src/test-mode.c @@ -14,7 +14,6 @@ #include #include -#define SYSREPO_TIMEOUT 60000 /* 60s, this is the timeout we use in our frontends. */ sr_subscription_ctx_t *sub = NULL; sr_conn_ctx_t *conn;