Skip to content

Instantly share code, notes, and snippets.

@hone
Created December 15, 2009 21:13
Show Gist options
  • Select an option

  • Save hone/257313 to your computer and use it in GitHub Desktop.

Select an option

Save hone/257313 to your computer and use it in GitHub Desktop.
# or some way to figure out the app name
desc "Run worker for an hour then tear down"
task :run_worker do
require 'heroku'
appname = ENV['NEW_RELIC_APPNAME']
time = 60 * 60 # hour
heroku_client = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
heroku_client.set_workers(appname, '+1')
sleep(time)
heroku_client.set_workers(appname, '-1')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment