1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00

Merge branch 'master' of github.com:actix/examples

This commit is contained in:
Nikolay Kim 2019-04-16 15:03:20 -07:00
commit 0faa540b8d
2 changed files with 6 additions and 4 deletions

View File

@ -58,7 +58,7 @@ fn get_hottest_years(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
.collect::<Vec<WeatherAgg>>()) .collect::<Vec<WeatherAgg>>())
})?; })?;
sleep(Duration::from_secs(2)); sleep(Duration::from_secs(2)); //see comments at top of main.rs
Ok(annuals) Ok(annuals)
} }
@ -84,7 +84,7 @@ fn get_coldest_years(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
.collect::<Vec<WeatherAgg>>()) .collect::<Vec<WeatherAgg>>())
})?; })?;
sleep(Duration::from_secs(2)); sleep(Duration::from_secs(2)); //see comments at top of main.rs
Ok(annuals) Ok(annuals)
} }
@ -111,7 +111,7 @@ fn get_hottest_months(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
.collect::<Vec<WeatherAgg>>()) .collect::<Vec<WeatherAgg>>())
})?; })?;
sleep(Duration::from_secs(2)); sleep(Duration::from_secs(2)); //see comments at top of main.rs
Ok(annuals) Ok(annuals)
} }
@ -137,6 +137,6 @@ fn get_coldest_months(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
.collect::<Vec<WeatherAgg>>()) .collect::<Vec<WeatherAgg>>())
})?; })?;
sleep(Duration::from_secs(2)); sleep(Duration::from_secs(2)); //see comments at top of main.rs
Ok(annuals) Ok(annuals)
} }

View File

@ -8,6 +8,8 @@ This project illustrates two examples:
2. An asynchronous handler that executes 4 queries in *parallel*, 2. An asynchronous handler that executes 4 queries in *parallel*,
collecting the results and returning them as a single serialized json object collecting the results and returning them as a single serialized json object
Note: The use of sleep(Duration::from_secs(2)); in db.rs is to make performance
improvement with parallelism more obvious.
*/ */
use std::io; use std::io;