我有一个Flask应用程序,它在uwsgi后面运行,在app.ini
文件中有这些设置:
...
processes=1
threads=2
...
应用程序在一个具有通用烧瓶结构的文件中定义:
^{pr2}$我也使用pylibmc来访问ElastiCache,但是考虑到uwsgi生成线程和进程,并且pylibmc.客户是非常非线程安全的,因此我得到了很多错误。在
Of course this requires that you let the pool know when a thread is done with its reserved instance, so therefore
relinquish
must be called before thread exit.
但是我不手工生成线程,所以我不知道在哪里定义析构函数来调用池上的relinquish
以避免死连接。在
问题是:在uwsgi隐式创建线程的情况下,如何定义线程析构函数?
目前没有回答
相关问题 更多 >
编程相关推荐