From a9de5d5f8d178a37b1532fa8795aafd535e1cf04 Mon Sep 17 00:00:00 2001 From: Osamu Takiya Date: Sat, 23 Jun 2018 13:55:29 +0900 Subject: [PATCH 1/2] [modify] modify to no cache fot development environment --- config/environments/development.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 13aaacfe..55de0ca2 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,8 @@ # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? - config.action_controller.perform_caching = true + # config.action_controller.perform_caching = true + config.action_controller.perform_caching = false config.cache_store = :memory_store config.public_file_server.headers = { From e7b7fda1a2696223873b50237ecc4d3c076c0258 Mon Sep 17 00:00:00 2001 From: Osamu Takiya Date: Sat, 23 Jun 2018 14:09:22 +0900 Subject: [PATCH 2/2] [modify] fix whenever scheduling deployment --- config/deploy/production.rb | 2 +- config/schedule.rb | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 594f9f67..58ebb8f8 100755 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -4,7 +4,7 @@ set :branch, :master set :deploy_to, ENV["DEPLOY_DIR_FOR_PRODUCTION"] set :rails_env, 'production' -server ENV["DEPLOY_SERVER"], user: ENV["DEPLOY_USER_FOR_PRODUCTION"], roles: %w{web app db} # wheneverは無効化 +server ENV["DEPLOY_SERVER"], user: ENV["DEPLOY_USER_FOR_PRODUCTION"], roles: %w{web app db batch} set :ssh_options, { port: ENV["DEPLOY_SERVER_PORT"], diff --git a/config/schedule.rb b/config/schedule.rb index 24ee5d59..ad8182e7 100755 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -4,6 +4,8 @@ set :output, "#{Rails.root}/log/whenever.log" env :PATH, ENV['PATH'] -every 1.minute do - runner "TwitterApi::Tasks::SearchAndUpsertTweets.execute(search_word: '#幻水総選挙2018')" -end +if @environment.to_sym == :production + every 1.minute, roles: [:batch] do + runner "TwitterApi::Tasks::SearchAndUpsertTweets.execute(search_word: '#幻水総選挙2018')" + end +end \ No newline at end of file