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:
parent
17744bbfe4
commit
0b46125f5d
@ -1,4 +1,4 @@
|
|||||||
use actix_web::{blocking, Error as AWError};
|
use actix_web::{web, Error as AWError};
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use r2d2;
|
use r2d2;
|
||||||
@ -27,7 +27,7 @@ pub fn execute(
|
|||||||
query: Queries,
|
query: Queries,
|
||||||
) -> impl Future<Item = Vec<WeatherAgg>, Error = AWError> {
|
) -> impl Future<Item = Vec<WeatherAgg>, Error = AWError> {
|
||||||
let pool = pool.clone();
|
let pool = pool.clone();
|
||||||
blocking::run(move || match query {
|
web::block(move || match query {
|
||||||
Queries::GetTopTenHottestYears => get_hottest_years(pool.get()?),
|
Queries::GetTopTenHottestYears => get_hottest_years(pool.get()?),
|
||||||
Queries::GetTopTenColdestYears => get_coldest_years(pool.get()?),
|
Queries::GetTopTenColdestYears => get_coldest_years(pool.get()?),
|
||||||
Queries::GetTopTenHottestMonths => get_hottest_months(pool.get()?),
|
Queries::GetTopTenHottestMonths => get_hottest_months(pool.get()?),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user