From ad2602f114b1733922e131fedc3aa60cc838af4a Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Fri, 13 Jun 2025 12:20:46 +0530 Subject: [PATCH] Blacklist ubus object only in timed out --- libbbfdm-api/legacy/dmubus.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libbbfdm-api/legacy/dmubus.c b/libbbfdm-api/legacy/dmubus.c index d9b88b79..8586046f 100644 --- a/libbbfdm-api/legacy/dmubus.c +++ b/libbbfdm-api/legacy/dmubus.c @@ -236,13 +236,6 @@ static int __dm_ubus_call_sync_entry(struct dm_ubus_cache_entry *entry, const ch if (ubus_lookup_id(ubus_ctx, obj, &id)) { BBF_WARNING("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method); - - entry->consecutive_timeouts++; - if (entry->consecutive_timeouts >= UBUS_MAX_CONSECUTIVE_TIMEOUTS) { - entry->is_blacklisted = true; - BBF_ERR("UBUS [object: %s, method: %s] has been blacklisted due to repeated timeouts", obj, method); - } - return -1; } @@ -253,10 +246,12 @@ static int __dm_ubus_call_sync_entry(struct dm_ubus_cache_entry *entry, const ch BBF_ERR("UBUS invoke failed [object: %s, method: %s, timeout: %d ms] with error (%s:%d)", obj, method, timeout, err_msg, err); - entry->consecutive_timeouts++; - if (entry->consecutive_timeouts >= UBUS_MAX_CONSECUTIVE_TIMEOUTS) { - entry->is_blacklisted = true; - BBF_ERR("UBUS [object: %s, method: %s] has been blacklisted due to repeated timeouts", obj, method); + if (err == UBUS_STATUS_TIMEOUT) { + entry->consecutive_timeouts++; + if (entry->consecutive_timeouts >= UBUS_MAX_CONSECUTIVE_TIMEOUTS) { + entry->is_blacklisted = true; + BBF_ERR("UBUS [object: %s, method: %s] has been blacklisted due to repeated timeouts", obj, method); + } } } else { entry->consecutive_timeouts = 0;