Skip to content

Promises.any_fulfilled_future does not accept an Event #963

@hanazuki

Description

@hanazuki

Documentation on Promises.any_fulfilled_future_on says:

If event is supplied, which does not have value and can be only resolved, it's represented as :fulfilled with value nil.

But actually it fails when you pass an Event to the function.

Reproducing code:

require 'concurrent'
p Concurrent::VERSION

p Concurrent::Promises.any_fulfilled_future(Concurrent::Promises.resolved_event).value!  # => Expect nil

Output:

"1.1.10"
~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:2078:in `resolvable?': undefined method `fulfilled?' for #<Concurrent::Promises::Event:0x00007f672f3cfa30 resolved> (NoMethodError)

        future.fulfilled? ||
              ^^^^^^^^^^^
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:1658:in `on_blocker_resolution'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:808:in `callback_notify_blocked'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:786:in `call_callback'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:751:in `add_callback'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:732:in `add_callback_notify_blocked'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:1637:in `block in new_blocked_by'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:1637:in `each'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:1637:in `each_with_index'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:1637:in `new_blocked_by'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:312:in `any_fulfilled_future_on'
        from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promises.rb:299:in `any_fulfilled_future'
        from any_fulfilled_future.rb:4:in `<main>'

* Operating system:                linux
* Ruby implementation:             Ruby
* `concurrent-ruby` version:       1.1.10
* `concurrent-ruby-ext` installed: no
* `concurrent-ruby-edge` used:     no

Metadata

Metadata

Assignees

No one assigned

    Labels

    looking-for-contributorWe are looking for a contributor to help with this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions