From 8671b0cc7860a899b1a23cd04fc6d93358965330 Mon Sep 17 00:00:00 2001 From: Bostjan Meglic Date: Tue, 23 May 2023 10:31:11 +0000 Subject: [PATCH] [PCF] Fix calculation of NF Instance load information - the 'if' clause was comparing some value with an always '1' due to wrong calculation. Consequently, this 'if' statement never executed. - sizes for session pool and UE pools are directly linked between each other. We need to count the number of items only in one of the pools to correctly represent the NF load - if anything, we should also check the load of the application pool to determine correct load of the NF --- src/pcf/context.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/pcf/context.c b/src/pcf/context.c index 7545e61e5..10ce4ad22 100644 --- a/src/pcf/context.c +++ b/src/pcf/context.c @@ -597,15 +597,7 @@ pcf_app_t *pcf_app_find_by_app_session_id(char *app_session_id) int get_pcf_load(void) { - if (ogs_pool_avail(&pcf_ue_pool) / ogs_pool_size(&pcf_ue_pool) < - ogs_pool_avail(&pcf_sess_pool) / - ogs_pool_avail(&pcf_sess_pool)) { - return (((ogs_pool_size(&pcf_ue_pool) - - ogs_pool_avail(&pcf_ue_pool)) * 100) / - ogs_pool_size(&pcf_ue_pool)); - } else { - return (((ogs_pool_size(&pcf_sess_pool) - - ogs_pool_avail(&pcf_sess_pool)) * 100) / - ogs_pool_size(&pcf_sess_pool)); - } + return (((ogs_pool_size(&pcf_ue_pool) - + ogs_pool_avail(&pcf_ue_pool)) * 100) / + ogs_pool_size(&pcf_ue_pool)); }