remove comments
This commit is contained in:
parent
abe8a445ae
commit
859ff36771
@ -54,7 +54,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for MnmlSocket {
|
|||||||
ws::Message::Pong(_) => {
|
ws::Message::Pong(_) => {
|
||||||
self.hb = Instant::now();
|
self.hb = Instant::now();
|
||||||
}
|
}
|
||||||
ws::Message::Text(text) => (),
|
ws::Message::Text(_text) => (),
|
||||||
ws::Message::Close(_) => {
|
ws::Message::Close(_) => {
|
||||||
ctx.stop();
|
ctx.stop();
|
||||||
}
|
}
|
||||||
@ -127,7 +127,6 @@ fn create_pool(url: String) -> Pool<PostgresConnectionManager> {
|
|||||||
.expect("Failed to create pool.")
|
.expect("Failed to create pool.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// This struct represents state
|
|
||||||
struct State {
|
struct State {
|
||||||
pool: PgPool,
|
pool: PgPool,
|
||||||
}
|
}
|
||||||
@ -149,92 +148,3 @@ pub fn start() {
|
|||||||
.bind("127.0.0.1:40000").expect("could not bind to port")
|
.bind("127.0.0.1:40000").expect("could not bind to port")
|
||||||
.run().expect("could not start http server");
|
.run().expect("could not start http server");
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Debug,Clone,Serialize,Deserialize)]
|
|
||||||
// struct RpcErrorResponse {
|
|
||||||
// err: String
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn db_connection(url: String) -> Pool<PostgresConnectionManager> {
|
|
||||||
// let manager = PostgresConnectionManager::new(url, TlsMode::None)
|
|
||||||
// .expect("could not instantiate pg manager");
|
|
||||||
|
|
||||||
// Pool::builder()
|
|
||||||
// .max_size(DB_POOL_SIZE)
|
|
||||||
// .build(manager)
|
|
||||||
// .expect("Failed to create pool.")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // fn print_panic_payload(ctx: &str, payload: &(Any + Send + 'static)) {
|
|
||||||
// // let d = format!("{:?}", payload);
|
|
||||||
// // let s = if let Some(s) = payload.downcast_ref::<String>() {
|
|
||||||
// // &s
|
|
||||||
// // } else if let Some(s) = payload.downcast_ref::<&str>() {
|
|
||||||
// // s
|
|
||||||
// // } else {
|
|
||||||
// // // "PAYLOAD IS NOT A STRING"
|
|
||||||
// // d.as_str()
|
|
||||||
// // };
|
|
||||||
// // info!("{}: PANIC OCCURRED: {}", ctx, s);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// pub fn start() {
|
|
||||||
// // panic::set_hook(Box::new(|panic_info| {
|
|
||||||
// // print_panic_payload("set_hook", panic_info.payload());
|
|
||||||
// // if let Some(location) = panic_info.location() {
|
|
||||||
// // info!("LOCATION: {}:{}", location.file(), location.line());
|
|
||||||
// // } else {
|
|
||||||
// // info!("NO LOCATION INFORMATION");
|
|
||||||
// // }
|
|
||||||
// // }));
|
|
||||||
|
|
||||||
// let database_url = env::var("DATABASE_URL")
|
|
||||||
// .expect("DATABASE_URL must be set");
|
|
||||||
|
|
||||||
// let pool = db_connection(database_url);
|
|
||||||
|
|
||||||
// // {
|
|
||||||
// // let startup_connection = pool.get().expect("unable to get db connection");
|
|
||||||
// // startup(startup_connection).unwrap();
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// let server = TcpListener::bind("0.0.0.0:40000").unwrap();
|
|
||||||
|
|
||||||
// let warden_pool = pool.clone();
|
|
||||||
// spawn(move || {
|
|
||||||
// loop {
|
|
||||||
// let db_connection = warden_pool.get().expect("unable to get db connection");
|
|
||||||
// if let Err(e) = warden(db_connection) {
|
|
||||||
// info!("{:?}", e);
|
|
||||||
// }
|
|
||||||
// sleep(Duration::new(1, 0));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// for stream in server.incoming() {
|
|
||||||
// let db = pool.clone();
|
|
||||||
// spawn(move || {
|
|
||||||
// let mut websocket = accept(stream.unwrap()).unwrap();
|
|
||||||
// let rpc = Rpc {};
|
|
||||||
|
|
||||||
// loop {
|
|
||||||
// match websocket.read_message() {
|
|
||||||
// Ok(msg) => {
|
|
||||||
// let begin = Instant::now();
|
|
||||||
// let db_connection = db.get().expect("unable to get db connection");
|
|
||||||
// match receive(db_connection, begin, &rpc, msg, &mut websocket) {
|
|
||||||
// Ok(_) => (),
|
|
||||||
// Err(e) => warn!("{:?}", e),
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// // connection is closed
|
|
||||||
// Err(e) => {
|
|
||||||
// debug!("{:?}", e);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user