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

Optionally use a ThreadPoolExecutor for schema validation and json loading when using aiohttp #262

Open
dnp1 opened this issue Aug 3, 2018 · 1 comment

Comments

@dnp1
Copy link

dnp1 commented Aug 3, 2018

Parse Json and validate schemas are CPU bound tasks.
Parse and validate long bodies can impact the reactivity of the event loop.

Use a ThreadPoolExecutor is a simple and eficient solution.

However, isn't trivial use your packed solution aside a ThreadPoolExecutor, because it neeeds function independent from the event loop.

Currently, I dropped the use_args decorator and I am using my own implemented decorator.

But I would like using it again.

Why not allow the user provide a executor?

@sloria
Copy link
Member

sloria commented Jan 11, 2019

I'm open to this if it doesn't add too much complexity to the codebase. Rather than adding a parameter to provide an executor, I think I'd prefer exposing functions (parse_json, etc.) that could be passed to run_in_executor. PRs welcome.

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

No branches or pull requests

2 participants