Revision df47dd3c
Added by Thomas McKay over 8 years ago
lib/hammer_cli_csv/base.rb | ||
---|---|---|
80 | 80 |
option_threads.to_i.times do |current_thread| |
81 | 81 |
start_index = ((current_thread) * lines_per_thread).to_i |
82 | 82 |
finish_index = ((current_thread + 1) * lines_per_thread).to_i |
83 |
lines = csv[start_index...finish_index].clone |
|
84 |
splits << Thread.new do |
|
85 |
lines.each do |line| |
|
86 |
if line[NAME][0] != '#' |
|
87 |
yield line |
|
83 |
finish_index = csv.length if finish_index > csv.length |
|
84 |
if start_index <= finish_index |
|
85 |
lines = csv[start_index...finish_index].clone |
|
86 |
splits << Thread.new do |
|
87 |
lines.each do |line| |
|
88 |
if line[NAME][0] != '#' |
|
89 |
yield line |
|
90 |
end |
|
88 | 91 |
end |
89 | 92 |
end |
90 | 93 |
end |
Also available in: Unified diff
corrected threading
reports updated
removed debug