admin管理员组

文章数量:1123704

My Env:

  • DJANGO 4.1
  • UWSGI 2.0.26 processes + gevent mode

And I Use concurrent.futures.ThreadPoolExecutor as my thread pool

I know that django mysql connecition is thread local. If I create thread pool in request thread, then pool thread id is different in each request so mysql connection is not reused.But if I create thread pool in uwsgi processes,the connection cannot be recycled after request finished and it will throw "Mysql server has gone away" afeter a few time.

So how to reuse mysql connection correctly in my run env?

本文标签: python 3xHow to reuse mysql persistant connection in uwsgidjangomulti threadingStack Overflow