celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
595 stars 87 forks source link

bug in server_sent_events.rb example? #241

Open woto opened 7 years ago

woto commented 7 years ago

Hi, it seems some clients will not receive sse because they will be skiped while iterating? https://github.com/celluloid/reel/blob/master/examples/server_sent_events.rb#L33

@a = [0,1,2,4,3]
@a.each_with_index do |a,i|
  if a%2 == 0
    @a.delete(a) 
  end
end
puts @a.inspect

puts '--'

@a = [0,1,2,4,3]
@a = @a.delete_if {|a|  true if a%2 == 0}
puts @a.inspect
woto@kornev:/docker/box-docker$ ruby test.rb 
[1, 4, 3]
--
[1, 3]