Skip to content

Commit

Permalink
Fix return value of rabbit_priority_queue:delete_crashed/1
Browse files Browse the repository at this point in the history
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 5f0981c. Before that the result of
`BQ:delete_crashed/1` was simply ignored.
  • Loading branch information
gomoripeti committed Jan 16, 2025
1 parent 114a5c2 commit efd4e45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deps/rabbit/src/rabbit_priority_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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}) ->
Expand Down

0 comments on commit efd4e45

Please sign in to comment.