[ruby-talk:444064] is times() an async operation

for instance, 10.times do |s| puts s end 0 1 2 3 4 5 6 7 8 9 => 10 is the arguments block run in async mode? I have this question b/c my program quit earily. i don't know if it's due to somewhat async operations. the code is like (connection to rabbitmq), conn = Bunny.new conn.start ch = conn.create_channel exchange = ch.fanout("myfanout",:durable => true) 100.times do |s| exchange.publish(s.to_s) end It can't publish the entire 100 items to the broker, just some items. Thanks.

On December 17, 2022 7:53:39 AM UTC, Henry R via ruby-talk <ruby-talk@ml.ruby-lang.org> wrote:
... my program quit early. I don't know if it's due to somewhat async operations.
the code is like (connection to rabbitmq),
100.times do |s| exchange.publish(s.to_s) end
It can't publish the entire 100 items to the broker, just some items.
Take a look at: https://github.com/ruby-amqp/bunny/issues/611 Q: "the script below, which should publish 100000 messages, iteratatively with 3 seconds pause. Then the number of messages subscriber receives fluctuates. The fluctuation looks like random, e.g. [99804, 99815, 99809, 99836, 99823, 99864, 99815, 99809, 999821] and so on." A: "The code in this example does not use publisher confirms. Data safety is a joint responsibility of RabbitMQ nodes and your own code. See Publisher Data Safety." https://www.rabbitmq.com/publishers.html#data-safety https://www.rabbitmq.com/confirms.html#publisher-confirms

That makes sense to me. Thank you.
On December 17, 2022 7:53:39 AM UTC, Henry R via ruby-talk <ruby-talk@ml.ruby-lang.org> wrote:
... my program quit early. I don't know if it's due to somewhat async operations.
the code is like (connection to rabbitmq),
100.times do |s| exchange.publish(s.to_s) end
It can't publish the entire 100 items to the broker, just some items.
Take a look at: https://github.com/ruby-amqp/bunny/issues/611
Q: "the script below, which should publish 100000 messages, iteratatively with 3 seconds pause. Then the number of messages subscriber receives fluctuates. The fluctuation looks like random, e.g. [99804, 99815, 99809, 99836, 99823, 99864, 99815, 99809, 999821] and so on."
A: "The code in this example does not use publisher confirms. Data safety is a joint responsibility of RabbitMQ nodes and your own code. See Publisher Data Safety."
https://www.rabbitmq.com/publishers.html#data-safety https://www.rabbitmq.com/confirms.html#publisher-confirms
______________________________________________ ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org ruby-talk info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.org...
participants (2)
-
Frank J. Cameron
-
Henry R