[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.

···

______________________________________________
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 -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

... 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:

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."

https://www.rabbitmq.com/publishers.html#data-safety
https://www.rabbitmq.com/confirms.html#publisher-confirms

···

On December 17, 2022 7:53:39 AM UTC, Henry R via ruby-talk <ruby-talk@ml.ruby-lang.org> wrote:
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."

______________________________________________
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 -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

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:
losing published messages · Issue #611 · ruby-amqp/bunny · GitHub

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."

Publishers — RabbitMQ
Consumer Acknowledgements and Publisher Confirms — RabbitMQ

______________________________________________
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 -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

______________________________________________
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 -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org