From 124a50e6c1d1c8a3546a71d66c0a850e4f17cdc7 Mon Sep 17 00:00:00 2001 From: cmoussa1 Date: Fri, 15 Mar 2024 13:03:01 -0700 Subject: [PATCH] plugin: move flux_respond () to end of functions Problem: There are a couple callbacks in the plugin that call flux_respond () before they are done processing. Move these calls to just before the functions call "return". --- src/plugins/mf_priority.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/mf_priority.cpp b/src/plugins/mf_priority.cpp index 38971d0c..86dd2473 100644 --- a/src/plugins/mf_priority.cpp +++ b/src/plugins/mf_priority.cpp @@ -219,9 +219,6 @@ static void rec_update_cb (flux_t *h, goto error; } - if (flux_respond (h, msg, NULL) < 0) - flux_log_error (h, "flux_respond"); - if (!data || !json_is_array (data)) { flux_log (h, LOG_ERR, "mf_priority: invalid bulk_update payload"); goto error; @@ -259,6 +256,8 @@ static void rec_update_cb (flux_t *h, users_def_bank[uid] = def_bank; } + if (flux_respond (h, msg, NULL) < 0) + flux_log_error (h, "flux_respond"); return; error: flux_respond_error (h, msg, errno, flux_msg_last_error (msg)); @@ -284,9 +283,6 @@ static void rec_q_cb (flux_t *h, goto error; } - if (flux_respond (h, msg, NULL) < 0) - flux_log_error (h, "flux_respond"); - if (!data || !json_is_array (data)) { flux_log (h, LOG_ERR, "mf_priority: invalid queue info payload"); goto error; @@ -317,6 +313,8 @@ static void rec_q_cb (flux_t *h, q->priority = priority; } + if (flux_respond (h, msg, NULL) < 0) + flux_log_error (h, "flux_respond"); return; error: flux_respond_error (h, msg, errno, flux_msg_last_error (msg));