Skip to content

Instantly share code, notes, and snippets.

@variousred
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save variousred/0f47be5fd25d33d5f68a to your computer and use it in GitHub Desktop.
Save variousred/0f47be5fd25d33d5f68a to your computer and use it in GitHub Desktop.
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