Skip to content

Commit 874d989

Browse files
Fix coverage.
1 parent 4d09160 commit 874d989

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/async/scheduler.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def blocking_operation_wait(work)
6161

6262
private_constant :BlockingOperationWait
6363

64+
if ::IO::Event.const_defined?(:WorkerPool)
65+
WorkerPool = ::IO::Event::WorkerPool
66+
else
67+
WorkerPool = nil
68+
end
69+
6470
# Create a new scheduler.
6571
#
6672
# @public Since *Async v1*.
@@ -82,11 +88,7 @@ def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_
8288
@timers = ::IO::Event::Timers.new
8389

8490
if worker_pool == true
85-
if ::IO::Event.const_defined?(:WorkerPool)
86-
@worker_pool = ::IO::Event::WorkerPool.new
87-
else
88-
@worker_pool = nil
89-
end
91+
@worker_pool = WorkerPool&.new
9092
else
9193
@worker_pool = worker_pool
9294
end

0 commit comments

Comments
 (0)