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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-08-01 19:58:47 +02:00
parent 22a2b0205c
commit 00c6cb2333
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -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);
+6
View File
@@ -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 */
-1
View File
@@ -14,7 +14,6 @@
#include <limits.h>
#include <srx/common.h>
#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;