Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deamonize and detach forks.

  • Loading branch information...
commit 59095831643a471602ff09df01ad69a28af0b05a 1 parent 0960b1f
Alexis Bernard authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/parallel_batch.rb
View
3  lib/parallel_batch.rb
@@ -15,12 +15,13 @@ def self.find_or_create!
end
def self.start(concurrency = 1)
- concurrency.times { fork { start_fork } }
+ concurrency.times { Process.detach(fork { start_fork }) }
end
def self.start_fork
puts "#{self} has started with pid #{Process.pid}"
ActiveRecord::Base.connection.reconnect!
+ Process.daemon(false)
find_or_create!.run
end
Please sign in to comment.
Something went wrong with that request. Please try again.