1
0
mirror of https://github.com/actix/examples synced 2025-01-22 22:05:57 +01:00

use new location for blocking

This commit is contained in:
Nikolay Kim 2019-03-10 18:39:54 -07:00
parent 17744bbfe4
commit 0b46125f5d

View File

@ -1,4 +1,4 @@
use actix_web::{blocking, Error as AWError};
use actix_web::{web, Error as AWError};
use failure::Error;
use futures::Future;
use r2d2;
@ -27,7 +27,7 @@ pub fn execute(
query: Queries,
) -> impl Future<Item = Vec<WeatherAgg>, Error = AWError> {
let pool = pool.clone();
blocking::run(move || match query {
web::block(move || match query {
Queries::GetTopTenHottestYears => get_hottest_years(pool.get()?),
Queries::GetTopTenColdestYears => get_coldest_years(pool.get()?),
Queries::GetTopTenHottestMonths => get_hottest_months(pool.get()?),