Blacklist ubus object only in timed out

This commit is contained in:
Suvendhu Hansa 2025-06-13 12:20:46 +05:30
parent 25e2d0bab6
commit ad2602f114

View file

@ -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)) { if (ubus_lookup_id(ubus_ctx, obj, &id)) {
BBF_WARNING("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method); 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; return -1;
} }
@ -253,11 +246,13 @@ 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)", BBF_ERR("UBUS invoke failed [object: %s, method: %s, timeout: %d ms] with error (%s:%d)",
obj, method, timeout, err_msg, err); obj, method, timeout, err_msg, err);
if (err == UBUS_STATUS_TIMEOUT) {
entry->consecutive_timeouts++; entry->consecutive_timeouts++;
if (entry->consecutive_timeouts >= UBUS_MAX_CONSECUTIVE_TIMEOUTS) { if (entry->consecutive_timeouts >= UBUS_MAX_CONSECUTIVE_TIMEOUTS) {
entry->is_blacklisted = true; entry->is_blacklisted = true;
BBF_ERR("UBUS [object: %s, method: %s] has been blacklisted due to repeated timeouts", obj, method); BBF_ERR("UBUS [object: %s, method: %s] has been blacklisted due to repeated timeouts", obj, method);
} }
}
} else { } else {
entry->consecutive_timeouts = 0; entry->consecutive_timeouts = 0;
} }