lib/tobox/pool/fiber_pool.rb in tobox-0.1.6 vs lib/tobox/pool/fiber_pool.rb in tobox-0.2.0
- old
+ new
@@ -3,31 +3,21 @@
require "timeout"
require "fiber_scheduler"
module Tobox
class FiberPool < Pool
- class KillError < Interrupt; end
-
def initialize(_configuration)
Sequel.extension(:fiber_concurrency)
super
- @error_handlers = Array(@configuration.lifecycle_events[:error])
end
def start
@fiber_thread = Thread.start do
Thread.current.name = "tobox-fibers-thread"
FiberScheduler do
@workers.each_with_index do |wk, _idx|
- Fiber.schedule do
- wk.work
- rescue KillError
- # noop
- rescue Exception => e # rubocop:disable Lint/RescueException
- @error_handlers.each { |hd| hd.call(:tobox_error, e) }
- raise e
- end
+ Fiber.schedule { do_work(wk) }
end
end
end
end