lib/fasten/runner.rb in fasten-0.16.0 vs lib/fasten/runner.rb in fasten-0.18.0
- old
+ new
@@ -26,11 +26,11 @@
end
@tasks = TaskManager.new(targets: options[:targets] || [], runner: self)
@workers = []
- reconfigure(options)
+ reconfigure(**options)
end
def reconfigure(**options)
%i[name stats summary jobs worker_class fasten_dir use_threads ui_mode developer priority].each do |key|
send "#{key}=", options[key] if options.key? key
@@ -38,11 +38,13 @@
initialize_stats
end
def task(name, **opts, &block)
- tasks << task = Task.new(name: name, **opts, block: block)
+ opts[:name] = name
+ opts[:block] = block
+ tasks << task = Task.new(**opts)
task
end
def register(&block)
@@ -109,11 +111,11 @@
check_state
else
dispatch_pending_tasks
end
- break if tasks.no_running? && tasks.no_waiting? || state == :QUIT
+ break if (tasks.no_running? && tasks.no_waiting?) || state == :QUIT
end
remove_all_workers
end
@@ -127,10 +129,10 @@
ui.force_clear
end
end
def should_wait_for_running_tasks?
- tasks.running? && (tasks.no_waiting? || tasks.failed? || %i[PAUSING QUITTING].include?(state)) || tasks.running.map(&:weight).sum >= jobs
+ (tasks.running? && (tasks.no_waiting? || tasks.failed? || %i[PAUSING QUITTING].include?(state))) || tasks.running.map(&:weight).sum >= jobs
end
def wait_for_running_tasks
use_threads ? wait_for_running_tasks_thread : wait_for_running_tasks_fork
end