From efd4e45ed89c8f8036409c681d2df884b7dfe8ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Thu, 16 Jan 2025 17:34:19 +0100 Subject: [PATCH] Fix return value of `rabbit_priority_queue:delete_crashed/1` According to the `rabbit_backing_queue` behavious it must always return `ok`, but it used to return a list of results one for each priority. That caused the below crash further up the call chain. ``` > rabbit_classic_queue:delete_crashed(Q) ** exception error: no case clause matching [ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok] in function rabbit_classic_queue:delete_crashed/2 (rabbit_classic_queue.erl, line 516) ``` Other backing_queue implementations (`rabbit_variable_queue`) just exit with a badmatch upon error. This (very minor) issue is present since 3.13.0 when `rabbit_classic_queue:delete_crashed_in_backing_queue/1` was instroduced with Khepri in commit 5f0981c5. Before that the result of `BQ:delete_crashed/1` was simply ignored. --- deps/rabbit/src/rabbit_priority_queue.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deps/rabbit/src/rabbit_priority_queue.erl b/deps/rabbit/src/rabbit_priority_queue.erl index 9cb887b4f4a5..daeb1c31143e 100644 --- a/deps/rabbit/src/rabbit_priority_queue.erl +++ b/deps/rabbit/src/rabbit_priority_queue.erl @@ -187,7 +187,9 @@ delete_crashed(Q) -> BQ = bq(), case priorities(Q) of none -> BQ:delete_crashed(Q); - Ps -> [BQ:delete_crashed(mutate_name(P, Q)) || P <- Ps] + Ps -> + [ok = BQ:delete_crashed(mutate_name(P, Q)) || P <- Ps], + ok end. purge(State = #state{bq = BQ}) ->