I
I
i_surin2016-07-02 07:37:19
Python
i_surin, 2016-07-02 07:37:19

Why is the telegram bot process constantly shutting down on heroku?

I uploaded the bot to Heroku, everything works, the main task is to send reminders, but it only partially copes with it.
Reminders work like this:

def back_func(message):
    main_keyboard = telebot.types.ReplyKeyboardMarkup(True, False)
    main_keyboard.row('/1. Команда 1')
    main_keyboard.row('/2. Команда 2')
    bot.send_message(message.from_user.id, 'Ответ', reply_markup=main_keyboard)
    k = 1
    while k < 2:
        sleep(60)
        handler_remind(message)
        k += 1
        if k == 2:
            break

so if sleep is a minute or something like that, then everything is in order, everything comes, but if I set an hour, then in the logs on heroku after a while it says that the process has simply stopped
2016-07-02T04:27:24.307059+00:00 heroku[web.1]: Idling
2016-07-02T04:27:27.008404+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-07-02T04:27:28.452832+00:00 heroku[web.1]: Process exited with status 143

how to deal with it? is it possible to use such cycles on heroku at all?
I read about errors, procfile rules, now it looks like this:
web: (python -m http.server $PORT &) && (python bot.py)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deny, 2018-05-15
@deny

On the free plan, Heroku disables processes after 30 minutes of inactivity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question