Skip to content

Use more idiomatic maybe feature #13929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025
Merged

Use more idiomatic maybe feature #13929

merged 2 commits into from
May 21, 2025

Conversation

ansd
Copy link
Member

@ansd ansd commented May 21, 2025

No description provided.

@ansd ansd requested a review from Copilot May 21, 2025 15:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR refactors queue declaration logic to leverage the new maybe expression for more concise error‐handling and removes the now‐unused run_checks/2 helper.

  • Stream and quorum queue modules switch from run_checks/2 with an explicit case to a maybe block.
  • The run_checks/2 function and its export are removed from rabbit_queue_type_util.erl.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
deps/rabbit/src/rabbit_stream_queue.erl Replaced manual run_checks/2 invocation with a maybe expression in declare/2 for streams
deps/rabbit/src/rabbit_quorum_queue.erl Replaced manual run_checks/2 invocation with a maybe expression in declare/2 for quorums
deps/rabbit/src/rabbit_queue_type_util.erl Removed the run_checks/2 function and export, now unused after the refactoring
Comments suppressed due to low confidence (2)

deps/rabbit/src/rabbit_stream_queue.erl:140

  • Add or update unit tests to cover the new declare/2 branch using the maybe expression, ensuring both success and error paths for stream queues are exercised.
declare(Q, _Node) when ?amqqueue_is_stream(Q) ->

deps/rabbit/src/rabbit_quorum_queue.erl:251

  • Add or update unit tests to cover the new declare/2 branch using the maybe expression, ensuring both success and error paths for quorum queues are exercised.
maybe

GitHub action Build and Xref on OTP 26 errored with:
```
src/rabbit_quorum_queue.erl:252:9: syntax error before: ok
%  252|         ok ?= rabbit_queue_type_util:check_auto_delete(Q),
%     |         ^
```
@ansd ansd added this to the 4.2.0 milestone May 21, 2025
@michaelklishin michaelklishin merged commit 6dd7447 into main May 21, 2025
538 of 540 checks passed
@michaelklishin michaelklishin deleted the queue-checks branch May 21, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants