digital-fabric / polyphony

Fine-grained concurrency for Ruby
https://www.rubydoc.info/gems/polyphony
MIT License
658 stars 17 forks source link

Timeout.timeout with `nil` value #114

Closed floriandejonckheere closed 1 year ago

floriandejonckheere commented 1 year ago

According to Ruby documentation, calling Timeout.timeout with a nil or zero value will execute the block without any timeout. However, Polyphony does not support this:

irb(main):001:0> Timeout.timeout(nil) { puts "foo" }
/usr/local/bundle/gems/polyphony-1.4/lib/polyphony/extensions/object.rb:64:in `backend_timeout': no implicit conversion to float from nil (TypeError)

      Polyphony.backend_timeout(interval, with_exception, &block)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    from /usr/local/bundle/gems/polyphony-1.4/lib/polyphony/extensions/object.rb:64:in `cancel_after'
    from /usr/local/bundle/gems/polyphony-1.4/lib/polyphony/extensions/timeout.rb:17:in `timeout'
    from (irb):1:in `<main>'
    from bin/console:13:in `<main>'