Bunny.new raises RuntimeError when given frozen array of hosts #446

Closed
roback opened this Issue Nov 16, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@roback

roback commented Nov 16, 2016

Bunny raises RuntimeError: can't modify frozen Array when given a frozen array of hosts. The cause of this error is the call to map! in lib/bunny/session.rb. The fact that Bunny is modifying its arguments was (at least to me) unexpected behaviour.

require "bunny"

Bunny::VERSION
# => "2.6.1"

HOSTS = [
  "localhost",
].freeze

Bunny.new(hosts: HOSTS)
# => RuntimeError: can't modify frozen Array
#    from ~/.gem/ruby/2.3.1/gems/bunny-2.6.1/lib/bunny/session.rb:774:in `map!'

Is there is any reason for using map! instead of map here (apart from the minimal performance gain 😄 )?

michaelklishin added a commit that referenced this issue Nov 16, 2016

@michaelklishin michaelklishin self-assigned this Nov 16, 2016

@roback roback referenced this issue in twingly/twingly-amqp Nov 16, 2016

Closed

Remove workaround for "frozen array" error in bunny #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment