Answer the question
In order to leave comments, you need to log in
Why is threading running over and over in a flask app hosted on Heroku?
My __init__.py
from flask import Flask, request
from telebot import TeleBot
from configs import telegram_config
bot = TeleBot(telegram_config.TELEGRAM_API_TOKEN)
app = Flask(__name__)
app.config.update(
DEBUG=False
)
from bot_functions import news_publisher
from app import views
from app import bot
from time import sleep
from threading import Thread
from random import randint
def sender():
while True:
print('turned on')
random_time = randint(60, 90)
sleep(random_time)
t = Thread(target=sender, name='sender')
t.start()
2018-05-28T15:08:52.189169+00:00 app[web.1]: [2018-05-28 15:08:52 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:8)
2018-05-28T15:08:52.189364+00:00 app[web.1]: [2018-05-28 15:08:52 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:9)
2018-05-28T15:08:52.190164+00:00 app[web.1]: [2018-05-28 15:08:52 +0000] [8] [INFO] Worker exiting (pid: 8)
2018-05-28T15:08:52.191280+00:00 app[web.1]: [2018-05-28 15:08:52 +0000] [9] [INFO] Worker exiting (pid: 9)
2018-05-28T15:08:53.197374+00:00 app[web.1]: [2018-05-28 15:08:53 +0000] [18] [INFO] Booting worker with pid: 18
2018-05-28T15:08:53.205160+00:00 app[web.1]: [2018-05-28 15:08:53 +0000] [19] [INFO] Booting worker with pid: 19
Answer the question
In order to leave comments, you need to log in
Read " 12 factors " to understand how Heroku works and why you can't write programs for this platform the way you wrote.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question