ninenines / ranch

Socket acceptor pool for TCP protocols.
ISC License
1.19k stars 336 forks source link

Fix alarm setting typo `treshold` -> `threshold` #350

Open juhlig opened 3 days ago

juhlig commented 3 days ago

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.