RUBY-3429 Retry failed KMS requests by comandeo-mongo · Pull Request #2907 · mongodb/mongo-ruby-driver

@comandeo-mongo

@comandeo-mongo

jamis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good -- just the one question about integer division around the sleep call.

while (kms_context = Binding.ctx_next_kms_ctx(self)) do
begin
delay = Binding.kms_ctx_usleep(kms_context)
sleep(delay / 1_000_000) unless delay.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either delay or 1_000_000 needs to be a float here, otherwise it will use integer division. Unless the intention here is to use integer division?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you! Fixed.

@comandeo-mongo

jamis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍