-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No current context #128
Comments
I don't see anything obviously wrong in your example. I'm going to treat this as a bug and will investigate shortly. Thank you for reporting! |
It turns out that if you use ``__slots__`` in a ``threading.local`` subclass, it no longer works as a ``threading.local`` instance. The more you know... Fixes googleapis#128.
I'm using the cloud ndb in kubernetes. When I use put_async, I got context error:
Here's my test code:
|
@lchen4snap I believe you've found bug #213. This is fixed, but the fix has not made its way to a release yet. For now you can use the |
Good to know. Thank you @chrisrossi ! |
hasnt this issue been fixed yet |
Ok actually i found the solution its not a bug @app.after_request
@use_context
def start_thread(response: Response) -> Response:
"""
**start thread**
starting a separate thread to deal with tasks that where put aside during the request
"""
app.tasks_thread.start()
return response and use tasklets to save data inside the threads @tasklet
def save_model(self, model: ndb.Model) -> Future:
yield model.put_async()
|
Hi,
I'm not sure if this is a bug but it's not clear to me how to properly handle
client.context()
when handling multiple threads.Steps to reproduce
Code example
Stack trace
The text was updated successfully, but these errors were encountered: