lib/bluepill/group.rb in bluepill-0.0.62 vs lib/bluepill/group.rb in bluepill-0.0.63
- old
+ new
@@ -34,13 +34,21 @@
threads = []
affected = []
self.processes.each do |process|
next if process_name && process_name != process.name
affected << [self.name, process.name].join(":")
- threads << Thread.new { process.handle_user_command("#{event}") }
+ noblock = process.group_#{event}_noblock
+ if noblock
+ self.logger.debug("Command #{event} running in non-blocking mode.")
+ threads << Thread.new { process.handle_user_command("#{event}") }
+ else
+ self.logger.debug("Command #{event} running in blocking mode.")
+ thread = Thread.new { process.handle_user_command("#{event}") }
+ thread.join
+ end
end
- threads.each { |t| t.join }
+ threads.each { |t| t.join } unless threads.nil?
affected
end
END
end
@@ -67,6 +75,6 @@
end
lines << ""
end
end
-end
\ No newline at end of file
+end