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
TypeError: 'NoneType' object is not iterable #2
Comments
Thank you for reporting the issue, the only reason I can see here is that the thread executor to fetch all data when the iterator is call didn't wait to create the iterator. does this happen all the time ? I couldn't reproduce with my tests but looking at the call stack and the routing I don't see a typical django app. can you tell me more about your use case ? it seems you're using starlette for routing do you have any idea how is working with django and the async world ? What I can do to protect the code, is to try to block the async call, because in this specific use case I'm using threads to create the iterator.
Also, if you try to |
The code is using something like this: Not entirely sure why, but nesting the function, or creating a closure around it seemed to work.
closing this issue, since something else is going on. Cheers. Thanks for sharing the code. |
that's interesting, but still an issue I think would you try to patch the code locally and test ? I don't think people would make a closure as a workaround. Also I would be interested to know the performance difference between the workaround and the blocking one. Thanks for your help. diff --git a/django_async_orm/query.py b/django_async_orm/query.py
index 5df0118..90f12d3 100644
--- a/django_async_orm/query.py
+++ b/django_async_orm/query.py
@@ -66,7 +66,8 @@ class QuerySetAsync(QuerySet):
def __aiter__(self):
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
- executor.submit(self._fetch_all)
+ f = executor.submit(self._fetch_all)
+ f.result()
return AsyncIter(self._result_cache)
|
Thanks for sharing this library. Very interesting!
Any suggestions on why
NoneType
would be returned from async_all?py3.8.10
django3.2
The text was updated successfully, but these errors were encountered: