diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake index 5e5450d6e..035f479c3 100644 --- a/lib/tasks/site.rake +++ b/lib/tasks/site.rake @@ -28,6 +28,13 @@ namespace :site do site_is_primary = STDIN.gets.gsub("\n",'') site_is_primary = true if site_is_primary.downcase == 'yes' + puts "Is this the only site on this mechine?[Default No]:......" + site_is_alone = false + site_is_alone = STDIN.gets.gsub("\n",'') + site_is_alone = true if site_is_alone.downcase == 'yes' + + @resque_workers = site_is_alone ? 5 : 2 + resque_setting = ERB.new(File.new("lib/template/setting/resque.god.erb").read) File.open("config/resque.god", 'w') { |file| file.write(resque_setting.result) } diff --git a/lib/template/setting/resque.god.erb b/lib/template/setting/resque.god.erb index 4adbf4f01..93bb2b490 100644 --- a/lib/template/setting/resque.god.erb +++ b/lib/template/setting/resque.god.erb @@ -4,7 +4,7 @@ user_home = ENV['HOME'] || File.dirname(__FILE__) + '/../..' development_uid = '' development_gid = '' -num_workers = rails_env == 'production' ? 5 : 2 +num_workers = rails_env == 'production' ? <%= @resque_workers %> : 2 num_workers.times do |num| God.watch do |w|