ruby-concurrency / concurrent-ruby

Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
https://ruby-concurrency.github.io/concurrent-ruby/
Other
5.68k stars 418 forks source link

ResolvableEvent#resolve(true) should raise on reassignment #966

Closed hanazuki closed 1 year ago

hanazuki commented 1 year ago

This patch fixes the bug that calling ResolvableEvent#resolve with raise_on_reassign = true on an already resolved ResolvableEvent does not raise an exception.

Fixes: https://github.com/ruby-concurrency/concurrent-ruby/issues/964

It seems that this bug has been there for ~7 years: https://github.com/ruby-concurrency/concurrent-ruby/blob/4519f945cfdbe4287690c8b1dd0e5362f5412a1c/lib/concurrent/edge/future.rb#L180