Giter VIP home page Giter VIP logo

Comments (8)

paicha avatar paicha commented on June 12, 2024

代码已经持续运行超过两年了,但奇怪一直没有遇到相关的问题。
这里确实需要修改一下。

from gxgk-wechat-server.

NullYing avatar NullYing commented on June 12, 2024

的确有线程不安全的问题

from gxgk-wechat-server.

RockDeep avatar RockDeep commented on June 12, 2024

建议做成threadLocal,参照flask.request的实现方式

from gxgk-wechat-server.

NullYing avatar NullYing commented on June 12, 2024

flask.request的实现方式我看了,超级酷炫又晦涩难懂。还需要琢磨一段时间

from gxgk-wechat-server.

NullYing avatar NullYing commented on June 12, 2024

qq 20170617213810

如果直接用Local()去存储,好像也没什么大问题Local()是线程隔离的

from gxgk-wechat-server.

NullYing avatar NullYing commented on June 12, 2024

部署时,gunicorn是利用多进程方式部署应用的,所以就算使用global也会分配worker数的变量,所以之前的一段时间低频访问是没出现问题的

from gxgk-wechat-server.

NullYing avatar NullYing commented on June 12, 2024

可以使用flask的全局变量g代替使用

from flask import g

g.openid = openid

from gxgk-wechat-server.

paicha avatar paicha commented on June 12, 2024

提交一个 PR 吧

from gxgk-wechat-server.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.