google / mesop

Rapidly build AI apps in Python
https://google.github.io/mesop/
Apache License 2.0
5.64k stars 270 forks source link

Move copy_current_request_context to ensure thread-safety #1076

Closed wwwillchen closed 3 weeks ago

wwwillchen commented 3 weeks ago

This should fix the error I was getting in websockets mode:

ValueError: <Token var=<ContextVar name='flask.request_ctx' at 0x102d56c50> at 0x1138dbac0> was created in a different Context

See: https://github.com/pallets/flask/discussions/5254