Last active
August 29, 2015 14:17
-
-
Save variousred/0f47be5fd25d33d5f68a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClientApp.all.each do |client_app| | |
config_vars = ['RUBY_GC_HEAP_GROWTH_MAX_SLOTS', | |
'RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR', | |
'RUBY_GC_MALLOC_LIMIT_MAX', | |
'RUBY_GC_OLDMALLOC_LIMIT_MAX'] | |
heroku = ::Heroku::API.new(api_key: ENV['HEROKU_API_KEY']) | |
config_vars.each do |config_var| | |
begin | |
puts "setting #{config_var} on #{client_app.name}" | |
heroku.delete_config_var(client_app.name, config_var) | |
sleep(3.5) | |
rescue ::Heroku::API::Errors::RateLimitExceeded => e | |
puts "rate limit exceeded, sleeping for 60" | |
sleep 60 | |
retry | |
rescue ::Heroku::API::Errors::NotFound => e | |
puts "#{client_app.name} not found: #{e}" | |
sleep(3.5) | |
rescue ::Heroku::API::Errors::ErrorWithResponse => e | |
puts "some other error like 503: #{e}" | |
sleep(3.5) | |
retry | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment