lib/picky/scheduler.rb in picky-4.8.1 vs lib/picky/scheduler.rb in picky-4.9.0
- old
+ new
@@ -20,12 +20,16 @@
def finish
scheduler.join
end
def scheduler
- @scheduler ||= Procrastinate::Scheduler.start Procrastinate::SpawnStrategy::Default.new(@factor)
+ @scheduler ||= create_scheduler
end
+
+ def create_scheduler
+ Procrastinate::Scheduler.start Procrastinate::SpawnStrategy::Default.new(@factor)
+ end
else
def schedule
yield
end
@@ -34,10 +38,18 @@
end
end
end
def fork?
+ require 'procrastinate'
parallel && Process.respond_to?(:fork)
+ rescue LoadError => e
+ warn_procrastinate_missing
+ return false
+ end
+ def warn_procrastinate_missing
+ warn_gem_missing 'Procrastinate', 'parallelized indexing (with the procrastinate gem)' unless @gem_missing_warned
+ @gem_missing_warned = true
end
end
end
\ No newline at end of file