Skip to content

Commit 74836ef

Browse files
committed
Fix an issue about per worker context count calculate
1 parent 50b6642 commit 74836ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matrixeval/ruby/runner.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def report
145145
def parallel
146146
contexts = Context.all
147147

148-
contexts.each_slice(contexts.count / workers_count) do |sub_contexts|
148+
per_worker_contexts_count = [(contexts.count / workers_count), 1].max
149+
contexts.each_slice(per_worker_contexts_count) do |sub_contexts|
149150
threads << Thread.new do
150151
yield sub_contexts
151152
end

0 commit comments

Comments
 (0)