Replies: 3 comments
-
I am facing the same issue after upgrading flask to v 2.2.5 (python 3.11) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Interesting. not working: @copy_current_request_context
def do_something(param):
pass
loop.run_in_executor(
executor,
do_something
param
) working: def do_something(param):
pass
loop.run_in_executor(
executor,
copy_current_request_context(do_something)
param
) after removing |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm also encountering this issue, and neither approaches above worked for me. I'm on flask v 2.3.3 on Python 3.11. Were you able to get that to work consistently @danderwald? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use the main thread's request context in the sub-thread. So I use the decorator copy_current_request_context. But I got an error that <Token var=<ContextVar name='flask.request_ctx' at 0x1067aef90> at 0x106c71280> was created in a different Context.
The weirdest thing is when I debug the code one by one, I will get the expected results sometimes.
This is a simple code.
Environment:
Beta Was this translation helpful? Give feedback.
All reactions