In my project I have Nginx, Django and JQuery. I'm using JQuery post requests to call Django functions and sometimes it takes awhile to complete.
The problem is it looks like when I'm using async/await function with post, it blocks Nginx entirely until the task is completed. I can't even open a new tab or open my project on another computer
How can I fix that? Or should I use Celery instead?
JS function example:
async function very_long_function(params) {
// some code
await $.post(post_params).done(function (data) {
// some code with data Django returned
})
// some code that has to be after
}
nginx.conf file:
user nginx;
worker_processes 16;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65s;
include /etc/nginx/conf.d/*.conf;
}