From ca1ec8d9a722dd08f04c21981691d4c060f90a51 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 20 Dec 2018 23:42:05 -0800 Subject: GET methods not in transactions --- rust/src/api_wrappers.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs index c8f6b390..545a2079 100644 --- a/rust/src/api_wrappers.rs +++ b/rust/src/api_wrappers.rs @@ -36,8 +36,8 @@ macro_rules! wrap_entity_handlers { _context: &Context, ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); - // No transaction for GET - let ret = match conn.transaction(|| { + // No transaction for GET? + let ret = match (|| { let entity_id = FatCatId::from_str(&id)?; let hide_flags = match hide { None => HideFlags::none(), @@ -52,7 +52,7 @@ macro_rules! wrap_entity_handlers { Ok(entity) }, } - }) { + })() { Ok(entity) => $get_resp::FoundEntity(entity), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => @@ -239,11 +239,11 @@ macro_rules! wrap_entity_handlers { _context: &Context, ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); - // No transaction for GET - let ret = match conn.transaction(|| { + // No transaction for GET? + let ret = match (|| { let entity_id = FatCatId::from_str(&id)?; $model::db_get_history(&conn, entity_id, limit) - }) { + })() { Ok(history) => $get_history_resp::FoundEntityHistory(history), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => @@ -269,8 +269,8 @@ macro_rules! wrap_entity_handlers { _context: &Context, ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); - // No transaction for GET - let ret = match conn.transaction(|| { + // No transaction for GET? + let ret = match (|| { let rev_id = Uuid::from_str(&id)?; let hide_flags = match hide { None => HideFlags::none(), @@ -285,7 +285,7 @@ macro_rules! wrap_entity_handlers { Ok(entity) }, } - }) { + })() { Ok(entity) => $get_rev_resp::FoundEntityRevision(entity), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => @@ -308,10 +308,10 @@ macro_rules! wrap_entity_handlers { _context: &Context, ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); - // No transaction for GET - let ret = match conn.transaction(|| { + // No transaction for GET? + let ret = match (|| { $model::db_get_edit(&conn, edit_id)?.into_model() - }) { + })() { Ok(edit) => $get_edit_resp::FoundEdit(edit), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => @@ -355,12 +355,12 @@ macro_rules! wrap_entity_handlers { _context: &Context, ) -> Box + Send> { let conn = self.db_pool.get().expect("db_pool error"); - // No transaction for GET - let ret = match conn.transaction(|| { + // No transaction for GET? + let ret = match (|| { let entity_id = FatCatId::from_str(&id)?; let redirects: Vec = $model::db_get_redirects(&conn, entity_id)?; Ok(redirects.into_iter().map(|fcid| fcid.to_string()).collect()) - }) { + })() { Ok(redirects) => $get_redirects_resp::FoundEntityRedirects(redirects), Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => -- cgit v1.2.3