Conversation
message_retention, polling_interval, and writer_batch_delay only accepted strings like 1.day. A bare number, "1 day", or any other value raised NoMethodError. Parsing now returns that setting's default, matching the documented message_retention behavior. Numeric values are seconds, which is how YAML and ERB durations arrive through config_for. An ActiveSupport::Duration is kept as-is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SolidCable::Configuration#parse_durationis howmessage_retention,polling_interval, andwriter_batch_delayare read fromconfig/cable.yml. The README says a missingmessage_retention, or one that fails to parse, defaults to1.day. The parser only split on.and called the last segment as a method, and it rescued nothing.1.dayand0.1.secondsstill work. Anything else raisedNoMethodErrorwhile the listener was polling or while trim was reading the cutoff:1, or YAML0.1parsed as a float and then stringified)"1 day"<number>.<unit>config_foralso hands these settings through as numbers. An unquoted YAML number is aNumeric, and<%= 1.day %>becomes that duration'sto_s("86400"), which YAML loads as an integer number of seconds.SolidCable.configurecan pass anActiveSupport::Durationdirectly. Those are now accepted: a duration is returned as-is, and a number is seconds. A value that still cannot be parsed returns the default already configured for that setting (1.day,0.1.seconds, or0.001.seconds).