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

support async functions in cached/cachedmethod #112

Closed
wants to merge 8 commits into from

Conversation

hephex
Copy link

@hephex hephex commented Oct 30, 2018

Inspect the wrapped object, if it's a coroutine function await the future.

@tkem I copied and pasted the decorator code from the existing ones, let me know if you think it needs refactoring.

See inspect.iscoroutinefunction

Inspect the wrapped object, if it's a coroutine function await
the future.

See [inspect.iscoroutinefunction](https://docs.python.org/3/library/inspect.html#inspect.iscoroutinefunction)
@coveralls
Copy link

coveralls commented Oct 30, 2018

Coverage Status

Coverage decreased (-1.1%) to 98.462% when pulling 60db6e3 on hephex:support-async into 4448776 on tkem:master.

@tkem
Copy link
Owner

tkem commented Oct 31, 2018

Sorry, but I don't think that adding support for async functions/methods into the existing decorators is the right approach. It complicates implementation/maintenance, and - as you may have noticed by now - it's hard to get right while maintaining backwards compatibility with Python versions back to 2.7.
As stated before, I'd rather like to see this released as a separate module - preferably maintained by someone who is more familiar with all the async stuff than I am.

@tkem tkem closed this Oct 31, 2018
@hephex
Copy link
Author

hephex commented Oct 31, 2018

@tkem thanks for the feedback and sorry for the duplicate topic. Yes, supporting 2.7 and 3.5+ at the same time is quite tricky. I'll create a new package for the async decorators.

@tkem
Copy link
Owner

tkem commented Oct 31, 2018

@hephex: That sounds great! And sorry for the delay and letting you struggle for so long - real life got in the way...

@halfdanrump
Copy link

@hephex Awesome!

@hephex
Copy link
Author

hephex commented Dec 14, 2018

@halfdanrump I moved that code here https://github.com/hephex/asyncache

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

Successfully merging this pull request may close these issues.

None yet

4 participants