0

Since the start of June 2015, free Heroku dynos have had to sleep for six hours in a 24-hour interval, thus rendering things like New Relic useless.

I've got a Slack bot running on a free Heroku dyno that we use around the office for parsing Smartsheet documents and searching Google News. I was wondering if there's any way to keep this dyno alive for a certain time interval? Say, 7am-11pm every day? It'd leave the six-hour interval in there, while still keeping it active for business hours. Any ideas?

jwilso48
  • 1
  • 2

2 Answers2

1

Reading the docs, it looks like you can scale your app down to zero - in which case it won't be active.

So maybe do a heroku dyno:scale web=0 (if you just have a web dyno) during the periods you don't want activity. Or automate it maybe via some call to their API.

Jon Mountjoy
  • 4,498
  • 22
  • 24
0

You can use heroku scheduler to wake a sleeping dyno at a specified time. Then to keep it alive for x hours you can have the app make a get request to your site every half-hour for x hours. Please do not abuse this, as the tragedy of the Commons could ruin the free tier for all of us. Personally i use this technique for an app I need alive 1 hour per day.

aliotta
  • 1
  • 2