1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

use actix-threadpool for blocking calls

This commit is contained in:
Nikolay Kim
2019-03-28 05:16:43 -07:00
parent 4309d9b88c
commit 6e0fe7db2d
3 changed files with 7 additions and 7 deletions

View File

@ -37,11 +37,11 @@ pub enum BlockingError<E: fmt::Debug> {
impl<E: fmt::Debug> ResponseError for BlockingError<E> {}
impl<E: fmt::Debug> From<actix_rt::blocking::BlockingError<E>> for BlockingError<E> {
fn from(err: actix_rt::blocking::BlockingError<E>) -> Self {
impl<E: fmt::Debug> From<actix_threadpool::BlockingError<E>> for BlockingError<E> {
fn from(err: actix_threadpool::BlockingError<E>) -> Self {
match err {
actix_rt::blocking::BlockingError::Error(e) => BlockingError::Error(e),
actix_rt::blocking::BlockingError::Canceled => BlockingError::Canceled,
actix_threadpool::BlockingError::Error(e) => BlockingError::Error(e),
actix_threadpool::BlockingError::Canceled => BlockingError::Canceled,
}
}
}

View File

@ -162,7 +162,6 @@ pub mod dev {
pub mod web {
//! Various types
use actix_http::{http::Method, Response};
use actix_rt::blocking;
use futures::{Future, IntoFuture};
pub use actix_http::Response as HttpResponse;
@ -339,7 +338,7 @@ pub mod web {
I: Send + 'static,
E: Send + std::fmt::Debug + 'static,
{
blocking::run(f).from_err()
actix_threadpool::run(f).from_err()
}
use actix_service::{fn_transform, Service, Transform};