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

remove actix-threadpool.use actix_rt::task::spawn_blocking #1878

Merged
merged 9 commits into from
Jan 9, 2021

Conversation

fakeshadow
Copy link
Contributor

@fakeshadow fakeshadow commented Jan 6, 2021

PR Type

Dependency

PR Checklist

Check your PR fulfills the following:

  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

Remove actix-threadpool from actix-http and actix-web.

Use actix_rt::task::spawn_blocking as the new blocking thread pool.

actix_threadpool::BlockingError has been moved into actix_http::error module and can also be import from actix_web::error module.

This is not a break change from actix-web and actix-http as the public API and types related stays the same. It's only when factoring people may use actix-threadpool together in their app and import types(BlockingError for example) from there and that would be breaking.

@fakeshadow fakeshadow added A-http project: actix-http A-web project: actix-web B-semver-minor labels Jan 6, 2021
src/web.rs Outdated Show resolved Hide resolved
Canceled,
}

impl<E: fmt::Debug> std::error::Error for BlockingError<E> {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derive_more Error would delcare E the source

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copied from the actix-threadpool code and I believe it's explictly added by a PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay can do it later if needed

actix-http/src/error.rs Outdated Show resolved Hide resolved
@fakeshadow fakeshadow added the A-files project: actix-files label Jan 6, 2021
@fakeshadow
Copy link
Contributor Author

I've migrate actix-files to use spawn_blocking making it runs on typed future with every chunk. It's a semver-norelease change on it

Cargo.toml Outdated Show resolved Hide resolved
@robjtede robjtede merged commit fe392ab into master Jan 9, 2021
@robjtede robjtede deleted the feat/tokio-blocking-pool branch January 9, 2021 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-files project: actix-files A-http project: actix-http A-web project: actix-web B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants