Browse Source

Fix actix build hanging in docker (#3396)

Michael Hixson 7 years ago
parent
commit
173e1f19e3

+ 0 - 1
frameworks/Rust/actix/TODO.md

@@ -1 +0,0 @@
-All the other Rust frameworks are passing but Actix looks like it's being held up at `mio-uds 0.6.4` which seems specific to the actix / actix-web crates. 

+ 2 - 1
frameworks/Rust/actix/actix-base.dockerfile

@@ -1,6 +1,7 @@
 FROM tfb/rust:latest
 
-COPY ./ ./
+ADD ./ /actix
+WORKDIR /actix
 
 RUN cargo clean
 RUN RUSTFLAGS="-C target-cpu=native" cargo build --release

+ 2 - 2
frameworks/Rust/actix/src/db.rs

@@ -127,8 +127,8 @@ impl Handler<TellFortune> for DbExecutor {
                 items.sort_by(|it, next| it.message.cmp(&next.message));
                 Ok(items)
             }
-            Err(_) =>
-                Err(io::Error::new(io::ErrorKind::Other, "Databse error"))
+            Err(e) =>
+                Err(io::Error::new(io::ErrorKind::Other, e))
         }
     }
 }

+ 5 - 7
frameworks/Rust/actix/src/main.rs

@@ -119,7 +119,10 @@ fn fortune(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
                        .content_encoding(headers::ContentEncoding::Identity)
                        .body(res)?)
                 },
-                Err(_) => Ok(httpcodes::HTTPInternalServerError.into())
+                Err(e) => {
+                    println!("fortune error: {}", e);
+                    Ok(httpcodes::HTTPInternalServerError.into())
+                }
             }
         })
         .responder()
@@ -127,12 +130,7 @@ fn fortune(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
 
 fn main() {
     let sys = System::new("techempower");
-    let dbhost = match option_env!("DBHOST") {
-        Some(it) => it,
-        _ => "127.0.0.1"
-    };
-    let db_url = format!(
-        "postgres://benchmarkdbuser:benchmarkdbpass@{}/hello_world", dbhost);
+    let db_url = "postgres://benchmarkdbuser:benchmarkdbpass@TFB-database/hello_world";
 
     // Start db executor actors
     let addr = SyncArbiter::start(

+ 1 - 6
frameworks/Rust/actix/src/pg.rs

@@ -264,12 +264,7 @@ impl Handler<TellFortune> for PgConnection {
 
 fn main() {
     let sys = System::new("techempower");
-    let dbhost = match option_env!("DBHOST") {
-        Some(it) => it,
-        _ => "127.0.0.1"
-    };
-    let db_url = format!(
-        "postgres://benchmarkdbuser:benchmarkdbpass@{}/hello_world", dbhost);
+    let db_url = "postgres://benchmarkdbuser:benchmarkdbpass@TFB-database/hello_world";
 
     // Start db executor actors
     let addr = SyncArbiter::start(