Skip to content
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

Add ra:key_metrics/2 #461

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Add ra:key_metrics/2 #461

merged 1 commit into from
Jul 26, 2024

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Jul 25, 2024

Why

This allows the caller to pass a timeout to erpc:call/5.

ra:key_metrics(ServerId) is the same as:

ra:key_metrics(ServerId, ?DEFAULT_TIMEOUT).

This is a change of behavior because the default timeout was infinity, however this is now consistent with other public functions.

@dumbbell dumbbell requested a review from kjnilsson July 25, 2024 17:12
@dumbbell dumbbell self-assigned this Jul 25, 2024
@dumbbell
Copy link
Member Author

I set the default timeout to infinity to keep the existing behavior. Should I set it to ?DEFAULT_TIMEOUT so that the behavior is consistent with other functions?

@dumbbell dumbbell marked this pull request as ready for review July 26, 2024 07:52
@dumbbell
Copy link
Member Author

dumbbell commented Jul 26, 2024

Replying to my own question: I changed the patch to use the same default timeout than other functions.

This is a breaking change but I believe the timeout was rarely a problem for the callers of that API. Also, the new behavior is saner and consistent with other functions.

@the-mikedavis
Copy link
Member

It looks like the places that call key_metrics/1 in RabbitMQ already use erpc calls to the proper node so that only the first function clause of key_metrics/1 is ever used, and the callsites provide their own timeout: https://github.com/rabbitmq/rabbitmq-server/blob/963c5d6c8fdfd1affced492c68eaa4107e1d15d3/deps/rabbit/src/rabbit_quorum_queue.erl#L1118-L1119 for example. So for RabbitMQ I don't think we need to make any changes to address the breaking change.

[Why]
This allows the caller to pass a timeout to `erpc:call/5`.

`ra:key_metrics(ServerId)` is the same as:

    ra:key_metrics(ServerId, ?DEFAULT_TIMEOUT).

This is a change of behavior because the default timeout was `infinity`,
however this is now consistent with other public functions.
@dumbbell dumbbell merged commit 0641a54 into main Jul 26, 2024
9 checks passed
@dumbbell dumbbell deleted the export-ra-key_metrics/2 branch July 26, 2024 15:48
@dumbbell dumbbell added this to the 2.13.6 milestone Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants