Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx + uwsgi 502 Bad Gateway python

I'm running a script in python and takes a long time to process. The thing is if the function takes to long to run, i guess the nginx has a timeout, in his configuration and that prevents somekind of errors, and prevents the function to run completely.

I just want to know were i can increse the value of the timeout. Because i've tried some commands in the file conf of nginx such as:

uwsgi_connect_timeout 75;
uwsgi_send_timeout 75;
uwsgi_read_timeout 75;
keepalive_timeout 650;

but none of this worked.

Thks in advance

like image 932
Tiago Moutinho Avatar asked Mar 28 '26 15:03

Tiago Moutinho


1 Answers

The problem with just extending the timeout is that no matter how much longer you set it to you will run into limitations somewhere along the line. Either with the web server, the browser or your geocode calls. If it is something that routinely fails n times in a request, then you can't really make any guarantees.

So rather than having the client request hanging on a long running process (and by extension risking a server timeout), why don't you use something like celery to run those geocode tasks and on the client-side, submit your client-side request via javascript and poll the server for the answer via ajax until it get's a response?

like image 166
Mark Gemmill Avatar answered Mar 30 '26 10:03

Mark Gemmill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!