I’m learning python. I built a bot which parses data from some website every 30 minutes and sends me a message. When I deploy it to Render.com it kinda works but manually sending message doesn’t work. I’m talking about send_new_tweet(channel) function which is not getting executed. When I test it locally it works es expected.
I’m launching the app with gunicorn main:app command.
I marked with # executes pieces of code which I see in the log.
@app.route(‘/’, methods=[‘POST’,‘GET’])
def index():
if request.method == ‘POST’:
r = request.get_json()
if ‘message’ in r:
chat_id = r[‘message’][‘chat’][‘id’]
msg = r[‘message’][‘text’]
print(‘private message’, msg)
if ‘/start’ in msg:
send_message(chat_id, ‘working!’, disable_notification=True) # executes
send_new_tweet(channel) # DOES NOT EXECUTE ?
# send_message(channel, ‘test message’)
elif ‘channel_post’ in r:
print(‘channel message received’)
return '20
EDIT: I should probably mention there are no errors… it seems like its running fine but it does not execute that function. Also tested it on railway.app and it works as expected.
Trying to deploy and it fails for some reason. This is what I see in the log…
Jan 16 04:47:35 PM You should consider upgrading via the ‘pip install --upgrade pip’ command.
Jan 16 04:47:35 PM ==> Generating container image from build. This may take a few minutes…
Jan 16 04:49:09 PM ==> Uploading build…
Jan 16 04:49:30 PM ==> Build uploaded in 16s
Jan 16 04:49:30 PM ==> Build successful
Jan 16 04:49:30 PM ==> Deploying…
what’s weird is that it shows that the build failed but my bot is actually working…
It supposed to print some stuff in the log but I dont see it, maybe it just has some delay…
Right now is it says “Exited with status 1 because of an internal system error. Our team has been notified.” and the status is failed but it still works…
So my bot is working now, but for some reason sometimes its not responding. It supposed to print something in the log every 2 minutes but it went quiet for 20 minutes and then restarted.
Why does that happen? Any help is appreciated!
Web Services on the free instance type are automatically spun down after 15 minutes of inactivity. When a new request for a free service comes in, Render spins it up again so it can process the request.