Skip to content
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

@sync_to_async(thread_sensitive=True) #155

Open
kbhalerao opened this issue Apr 12, 2020 · 6 comments
Open

@sync_to_async(thread_sensitive=True) #155

kbhalerao opened this issue Apr 12, 2020 · 6 comments

Comments

@kbhalerao
Copy link

Hi - thank you for this wonderful project and its integration in Django 3.

I think I have noticed a bug - although it could be in my head. I believe the decorator @sync_to_async(thread_sensitive=True) as shown here is causing an error as follows:

@sync_to_async(thread_sensitive=True) TypeError: __init__() missing 1 required positional argument: 'func'

Using it as a function call await sync_to_async(my_sync_function, thread_sensitive=True)() works fine. I will look through the code and see if I can figure out how to fix this. I noticed there were no tests specifically testing the decorator with this option set.

Cheers
KB

@adamchainz
Copy link
Sponsor Member

Hi @kbhalerao

I think you've found the problem. It's documented as supporting that, but the code doesn't. It needs a test, then refactoring to match that.

@andrewgodwin
Copy link
Member

Yeah, I'm going to remove that from the documentation for now as it doesn't work yet. We should, however, add support for it in.

@andrewgodwin
Copy link
Member

I opened a PR to remove the doc example here: django/django#12706

@devxpy
Copy link

devxpy commented May 13, 2020

Happy to include support for doing this, as a part of #159, or once its merged in.

@andrewgodwin
Copy link
Member

It wouldn't be good form to mix it up with a pull request for a different thing - happy to accept a separate PR for that, though.

@updatedennismwangi
Copy link

Still having the issues as of now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants