diff --git a/Gemfile b/Gemfile index f04e838..b9c7109 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'chromedriver-helper' gem 'clockwork' gem 'foundation-rails', '~> 5' gem 'haml-rails' +gem 'platform-api' gem 'newrelic_rpm' gem 'oj' gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index f69c0fd..46bde4a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,6 +71,7 @@ GEM debug_inspector (0.0.3) erubi (1.7.1) erubis (2.7.0) + excon (0.62.0) execjs (2.7.0) ffi (1.9.25) font-awesome-rails (4.7.0.4) @@ -89,6 +90,11 @@ GEM haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) railties (>= 4.0.1) + heroics (0.0.24) + erubis (~> 2.0) + excon + moneta + multi_json (>= 1.9.2) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -111,6 +117,8 @@ GEM mini_mime (1.0.0) mini_portile2 (2.3.0) minitest (5.11.3) + moneta (0.8.1) + multi_json (1.13.1) newrelic_rpm (5.2.0.345) nokogiri (1.8.2) mini_portile2 (~> 2.3.0) @@ -119,6 +127,9 @@ GEM parser (2.5.1.0) ast (~> 2.4.0) pg (0.20.0) + platform-api (2.1.0) + heroics (~> 0.0.23) + moneta (~> 0.8.1) powerpack (0.1.2) pry (0.11.3) coderay (~> 1.1.0) @@ -250,6 +261,7 @@ DEPENDENCIES newrelic_rpm oj pg (= 0.20) + platform-api pry-rails puma rabl diff --git a/lib/tasks/restart_scraper.rb b/lib/tasks/restart_scraper.rb new file mode 100644 index 0000000..1891ca8 --- /dev/null +++ b/lib/tasks/restart_scraper.rb @@ -0,0 +1,9 @@ +require 'platform-api' + +namespace :scraper do + desc 'restarts scraper b/c of chrome memory leaks' + task restart_scraper: :environment do + heroku = PlatformAPI.connect_oauth(ENV['PLATFORM_OAUTH_TOKEN']) + heroku.dyno.restart('world-cup-json', 'clock.1') + end +end