Skip to content

Commit

Permalink
raising an invalid around callback error earlier on as soon as a fibe…
Browse files Browse the repository at this point in the history
…r is detected to be dead
  • Loading branch information
adviti-mishra committed Jul 18, 2024
1 parent 1732a2c commit f2ea1d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/mongoid/interceptable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ def _mongoid_run_child_callbacks_with_around(kind, children: nil, &block)
end
end

fibers.each(&:resume)
fibers.each do |fiber|
fiber.resume
raise Mongoid::Errors::InvalidAroundCallback unless fiber.alive?
end

block&.call

fibers.reverse.each(&:resume)

rescue FiberError
raise Mongoid::Errors::InvalidAroundCallback
end

# Execute the callbacks of given kind for embedded documents without
Expand Down

0 comments on commit f2ea1d5

Please sign in to comment.