From fee1e255acf74775f25c2aae900e1fee14121e39 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 11 Mar 2018 10:10:30 -0700 Subject: [PATCH] add comments --- examples/diesel/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/diesel/src/main.rs b/examples/diesel/src/main.rs index 75c201558..06cb485d6 100644 --- a/examples/diesel/src/main.rs +++ b/examples/diesel/src/main.rs @@ -1,8 +1,8 @@ //! Actix web diesel example //! //! Diesel does not support tokio, so we have to run it in separate threads. -//! Actix supports sync actors by default, so we going to create sync actor that will -//! use diesel. Technically sync actors are worker style actors, multiple of them +//! Actix supports sync actors by default, so we going to create sync actor that use diesel. +//! Technically sync actors are worker style actors, multiple of them //! can run in parallel and process messages from same queue. extern crate serde; extern crate serde_json; @@ -38,6 +38,7 @@ struct State { fn index(req: HttpRequest) -> Box> { let name = &req.match_info()["name"]; + // send async `CreateUser` message to a `DbExecutor` req.state().db.send(CreateUser{name: name.to_owned()}) .from_err() .and_then(|res| { @@ -54,7 +55,7 @@ fn main() { let _ = env_logger::init(); let sys = actix::System::new("diesel-example"); - // Start db executor actors + // Start 3 db executor actors let addr = SyncArbiter::start(3, || { DbExecutor(SqliteConnection::establish("test.db").unwrap()) });