Tweepy Bot Crashes After Duplicates - heroku

I have a question about running my Twitter bot 24/7, and I already have it uploaded to Heroku. The code works great.
However, the dynos will fall asleep after 30 minutes of non-use. This is great, however, my code is programming to tweet the same thing once a day.
In order to keep the dynos alive, the code has to be run every 30 minutes. The tweet, however, is the same thing once a day.
Is there a way to keep the Twitter code running when receiving a duplicate?

It seems like you want to bypass the limit, but that is not possible. if you keep running that service all day your free hours will expire.
Verified accounts come with a monthly pool of 1000 Free dyno hours; unverified >accounts receive 550. When a Free dyno is active, it draws from the pool; your free >apps can run as long as there are dyno hours left in your monthly pool.
instead, better to upgrade the Heroku to the premium version.

Related

How many days does a free Heroku app stay up?

According to heroku
Starting today, Heroku accounts have an account-based pool of free dyno hours for use on free apps. This replaces the 18 hours a day limit on free apps, allowing a free app to run 24/7 if needed. New accounts receive 550 free dyno hours and you can verify your identity with a credit card for an additional 450 hours
→ How are dyno hours calculated
If my app is always up, how many days will it stay up for (If I have 550 dyno hours) or does it depend on traffic and usage?
An app consumes hours based on their uptime, no matter the usage or traffic your app receives.
If you do the math, 550 hours is equal to 22.92 days.
If you were to add your payment method, it would give you a thousand hours, enough for a single app to run 24/7.

Why isn't free dyno usage updating?

I've had this heroku account for almost two weeks, but in the billing section my free dyno hours used this month remains at 0%. This isn't possible because I've set an uptimerobot to hit my heroku API every 29 minutes (to prevent it from sleeping).
Contemplating upgrading to Hobby so accurate info is nice to have here.

Heroku website only loads slowly the first time, even after clearing local cache?

I have a website hosted on heroku. Whenever I load it for the first time after awhile (I haven't figured out the exact interval yet, be it days or hours), it takes upwards of 15 seconds to load. Subsequent loads are <1second, even if I clear the cache completely and open it in an incognito tab.
Why might this be? It almost seems like some kind of DNS issue but I haven't really got a clue. I don't know how to troubleshoot something like this. The situation seems to be the same even on other computers at other locations.
Quoting the Heroku docs:
If an app has a free web dyno, and that dyno receives no web traffic in a 30-minute period, it will sleep.
When the dyno receives traffic again, it will take a few seconds to wake up, hence the delay you've experienced.
Note that the Heroku free tier also has a maximum number of dyno hours per month. A sleeping dyno doesn't use any hours, but it does when it's active. When the hours are used up, the dyno won't wake up to incoming traffic.
You can see your remaining quota of dyno hours with:
$ heroku ps -a <app name>
Heroku suggests upgrading to a hobby dyno if your app needs to be permanently accessible. More info on https://devcenter.heroku.com/articles/free-dyno-hours
On the free tier, Heroku dynos go to sleep if they aren't used after an hour or something like that. They take a few seconds to wake up. Pay for the service and it stops happening, or write a script to ping your site every couple minutes or something.

Can i use Free Heroku plan as a Telegram Bot?

I want to use Telegram Bot with enabled webHook,
Can I use Heroku free plan as my Bot's Url to hook up when received text message ?
I'm using Nodejs as language.
Yes, you can and it works fine. But Heroku will try to freeze your app for some time. In fact it can't be active for more than 18 of the last 24 hours.
And if you will prevent it, with ping your app or your bot will continuously receive messages, your app will recharge next 6 hours. It's a limit of the free plan.
I suggest that you use Openshift, it doesn't have such limits in free tier.
I guess another suggestion I can make is for you to use glitch.
I use glitch for all the bots I have made so far, it's free, easy to get started with. It also has the limitation where it sleeps after 5 minutes of your bot not being active.
In a post they say the reason why and how to solve it:
Apps sleeping is a large reason why we can offer the Glitch service
for free, so it’s not something we can turn off. However, we accept
that for some use-cases, like bots with no webhooks support, that’s
not ideal. It’s possible to expose a route in your app that a web cron
service or uptime monitoring service can hit and cause your bot to
wake. Doing that every 5 mins or so should do what you want.
Hope it helps.
I have a couple of telegram bots hosted on Heroku's free plan, with webhooks active.
They work fine but as mentioned in other answers the app is put to sleep after 30 minutes of inactivity: webhooks will reactivate it but when waking up there will be some lag and rarely some malfunctions (I lost a couple of commands).
There is a monthly limit of usage time but unless the bot is heavily used I found that this has not ever been a problem.
All in all I like the service, especially since it is free.

Hubot Heroku route message on startup

I have deployed a Hubot on Heroku to interact with Slack. I am using a free dyno currently. After 30 minutes of inactivity, it goes to sleep. It wakes up when pinged from Slack. However, the first request is lost in the mix. So the user has to type the command a second time. Is there an easy way to make the bot wake up and still handle the first command?
As stated in the documentation :
To get around this, you can use the hubot-heroku-keepalive script, which will keep your free dyno alive for up to 18 hours/day. If you never want Hubot to sleep, you will need to upgrade to Heroku's hobby plan.
I use it so Hubot is at least online from 6 AM to midnight.

Resources