maxbellec
maxbellec

Reputation: 17491

Threading module is very slow when behind uwsgi

In a view I use the threading module to launch a task in the background and immediately return the view (I need to launch it in the background since I need to wait for the response of an I/O operation).

The thread that is run is a python function that takes almost no time (~0.1s) when run on its own but can take up to an hour when run using the threading module.

My app is a Django app running behind uwsgi. What is the cause?

Upvotes: 1

Views: 608

Answers (1)

maxbellec
maxbellec

Reputation: 17491

According to the doc,

threads generated by your application will never run

Simply add

enable-threads  = true

to your .ini file or the --enable-threads flag when running uwsgi.

Upvotes: 2

Related Questions