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

Fix alarm setting typo treshold -> threshold #350

Closed

Conversation

juhlig
Copy link
Contributor

@juhlig juhlig commented Oct 2, 2024

Fixes #349.

The misspelled option treshold is still accepted by ranch:start_listener/5 and ranch:set_transport_options/2, and will be normalized to threshold internally. The transport options are however stored in ranch_server as they were given (ie, with possibly misspelled tresholds), such that ranch:get_transport_options/1 returns them unchanged. It would have been easier to store them normalized, but there is an (admittedly off) chance that this may break existing code which has expectations as to the naming of the key in the return from ranch:get_transport_options/1.

I also changed the alarm type by changing the treshold key to threshold. I did, however, not do anything to also allow the treshold key there, so dialyzer may (ie, I didn't check) complain on existing code using it. I think this is just as well, since it would serve as an incentive to adapt.

The documentation has been adapted by replacing all occurrences of "treshold" or "Treshold" with "threshold" or "Threshold", respectively. The treshold key is now effectively undocumented.

The respective test acceptor_SUITE:misc_connection_alarms, which uses two alarms, has been changed such that one uses the properly spelled and one the misspelled option.

@juhlig juhlig mentioned this pull request Oct 2, 2024
@juhlig
Copy link
Contributor Author

juhlig commented Oct 21, 2024

@essen what about this PR?

@essen
Copy link
Member

essen commented Nov 6, 2024

I have updated the CI, please force push to run CI again.

@juhlig juhlig force-pushed the fix_typo_treshold_to_threshold branch from 17d658c to 2436ade Compare November 7, 2024 07:18
@@ -597,7 +597,7 @@ misc_connection_alarms(_) ->
Self ! {connection_alarm, {Ref, AlarmName, length(ActiveConns)}}
end,
Alarms0 = #{
test1 => Alarm1 = #{type => num_connections, treshold => 2, cooldown => 0, callback => AlarmCallback},
test1 => Alarm1 = #{type => num_connections, threshold => 2, cooldown => 0, callback => AlarmCallback},
Copy link
Member

Choose a reason for hiding this comment

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

We should probably keep a test that uses treshold.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do, see the next line after this one.

Copy link
Member

Choose a reason for hiding this comment

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

Ahah understood. In that case a comment before the next line should say that we are testing for backward compatibility but that it should be removed in 3.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in last commit.

The setting `threshold` was misspelled as `treshold`.
@juhlig juhlig force-pushed the fix_typo_treshold_to_threshold branch from b3dc646 to 37d77a9 Compare November 11, 2024 08:41
@essen
Copy link
Member

essen commented Nov 12, 2024

Merged, thanks!

@essen essen closed this Nov 12, 2024
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.

Ranch alarms option typo
3 participants