summaryrefslogtreecommitdiffhomepage
path: root/src/python/nxt_python_wsgi.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2021-07-20 10:37:54 +0300
committerMax Romanov <max.romanov@nginx.com>2021-07-20 10:37:54 +0300
commitf27fbd9b4d2bdaddf1e7001d0d0bc5586ba04cd4 (patch)
tree1d1156008cfc59e14d643a3d66f83b56b7e35a7e /src/python/nxt_python_wsgi.c
parentdfbdc1c11a201e46d61f4bc61cfbe5741fc4fd70 (diff)
downloadunit-f27fbd9b4d2bdaddf1e7001d0d0bc5586ba04cd4.tar.gz
unit-f27fbd9b4d2bdaddf1e7001d0d0bc5586ba04cd4.tar.bz2
Python: using default event_loop for main thread for ASGI.
Unit's ASGI implementation creates a new event loop to run an application for each thread since 542b5b8c0647. This may cause unexpected exceptions or strange bugs if asyncio synchronisation primitives are initialised before the application starts (e.g. globally). Although the approach with a new event loop for the main thread is consistent and helps to prepare the application to run in multiple threads, it can be a source of pain for people who just want to run single-threaded ASGI applications in Unit. This is related to #560 issue on GitHub.
Diffstat (limited to '')
-rw-r--r--src/python/nxt_python_wsgi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/python/nxt_python_wsgi.c b/src/python/nxt_python_wsgi.c
index b80d10fa..87dcfaa2 100644
--- a/src/python/nxt_python_wsgi.c
+++ b/src/python/nxt_python_wsgi.c
@@ -51,7 +51,7 @@ typedef struct {
} nxt_python_ctx_t;
-static int nxt_python_wsgi_ctx_data_alloc(void **pdata);
+static int nxt_python_wsgi_ctx_data_alloc(void **pdata, int main);
static void nxt_python_wsgi_ctx_data_free(void *data);
static int nxt_python_wsgi_run(nxt_unit_ctx_t *ctx);
static void nxt_python_wsgi_done(void);
@@ -210,7 +210,7 @@ fail:
static int
-nxt_python_wsgi_ctx_data_alloc(void **pdata)
+nxt_python_wsgi_ctx_data_alloc(void **pdata, int main)
{
nxt_python_ctx_t *pctx;