#Application failed to respond | Server Error | Postgres | Python
38 messages · Page 1 of 1 (latest)
Project ID: b62b596e-1a25-4559-a32c-c74d00634378
how long would you expect the api call to take?
the default gunicorn timeout is 30 seconds, could you be running into that?
I'd say about five minutes...
is this a post or get request?
post
and how long does the request fail after
after 15 or 20 seconds
I need the server to wait much longer until all the items are changed, and not give this error.
railway has a 5 minute time limit on post requests (you cant change this), and gunicorn has a 30 second time limit on any request (can be changed)
but if you say your requests are failing after 20 seconds, you arent running into any of those limits
is there anything in the deployment logs that could be useful?
Locally, even if I have to import a lot of items into the database, or change them, it works smoothly. But you mentioned two possibilities. I think it could be gunicorn, because I use it as a manager.
use this to download the deployment logs https://bookmarklets.up.railway.app/log-downloader/
How can I make the gunicorn wait longer than 30s?
Well, thank you. I'll implement it and let you know if it worked or not. Thank you, Brody.
Yes, just a guess. Is a short time, like 20s, but 30s can be too.
gotcha
Brody, this worked more or less well.
I did this in my Procfile and I don't used the domain recorded in Cloudflare:
web: python manage.py migrate && gunicorn myapp.wsgi --log-file - --timeout 600
Now the request wait 5 minutes. After this I get this page. You sad that Railway has a 5 minute time limit on post requests... Can you tell me where can I change it, please?
plese read my messages more carefully..
railway has a 5 minute time limit on post requests (you cant change this)
Here?
no
plese read my messages more carefully..
railway has a 5 minute time limit on post requests (you cant change this)
Sorry. I understand.
In that case, is there anything I can do?
The connection between Django/Python seems to be a bit slow with Postgres.
write more efficient sql queries?
10k rows doesnt seem like a lot in the grand scheme of things, and 5 minutes for that seems like you are running into inefficiencies in your code
I didn't write the SQL queries. It's from the Django integration itself.
fair enough, django is not known for speed
I'll see if there's anything I can do to optimize it, but I don't know.
what does this post request do?
when will you typically need to make this post request?
tell me as much information about this task as you can
I have some tables in my database. One of them consists of more than 100k registered products, and the other is a table of government product codes. And when there is a change in the code description, this change should replicate to all the products in the product database. Normally there aren't so many products linked to a single code, but there are about 7 that have about 12k products linked, in which case the timeout exceeds the limit and doesn't change them.
then you would want to do this as a background task when data is changed, not through a post request, and especially not holding up the post request response