Comments (8)
代码已经持续运行超过两年了,但奇怪一直没有遇到相关的问题。
这里确实需要修改一下。
from gxgk-wechat-server.
的确有线程不安全的问题
from gxgk-wechat-server.
建议做成threadLocal,参照flask.request的实现方式
from gxgk-wechat-server.
flask.request的实现方式我看了,超级酷炫又晦涩难懂。还需要琢磨一段时间
from gxgk-wechat-server.
如果直接用Local()去存储,好像也没什么大问题Local()是线程隔离的
from gxgk-wechat-server.
部署时,gunicorn是利用多进程方式部署应用的,所以就算使用global也会分配worker数的变量,所以之前的一段时间低频访问是没出现问题的
from gxgk-wechat-server.
可以使用flask的全局变量g代替使用
from flask import g
g.openid = openid
from gxgk-wechat-server.
提交一个 PR 吧
from gxgk-wechat-server.
Related Issues (7)
- 成绩查询和图书续借功能有问 HOT 8
- SQLAlchemy 关闭 HOT 1
- 能不能提供一个完整版 HOT 1
- 调试时的问题 HOT 11
- 数据库创建 HOT 1
- Python 'tuple' cannot be converted to a MySQL type HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gxgk-wechat-server.