about summary refs log tree commit diff
path: root/src/database/mod.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-02-15 02:44:33 +0300
committerVika <vika@fireburn.ru>2022-02-15 02:46:24 +0300
commit9e4c4551a786830bf34d74c4ef111a8ed292fa9f (patch)
tree7796d7e529c89f22bccfbba4566b6bf5efca8071 /src/database/mod.rs
parentd1327ed6b28a49770aa5d9b06245aa063b406f78 (diff)
downloadkittybox-9e4c4551a786830bf34d74c4ef111a8ed292fa9f.tar.zst
WIP: convert to Tokio and Warp
Warp allows requests to be applied as "filters", allowing to flexibly
split up logic and have it work in a functional style, similar to
pipes.

Tokio is just an alternative runtime. I thought that maybe switching
runtimes and refactoring the code might allow me to fish out that
pesky bug with the whole application hanging after a certain amount of
requests...
Diffstat (limited to 'src/database/mod.rs')
-rw-r--r--src/database/mod.rs38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/database/mod.rs b/src/database/mod.rs
index c0f9f29..55ab027 100644
--- a/src/database/mod.rs
+++ b/src/database/mod.rs
@@ -2,13 +2,6 @@
 use async_trait::async_trait;
 use serde::{Deserialize, Serialize};
 
-//#[cfg(feature="redis")]
-//mod redis;
-//#[cfg(feature="redis")]
-//pub use crate::database::redis::RedisStorage;
-//#[cfg(all(redis, test))]
-//pub use redis::tests::{get_redis_instance, RedisInstance};
-
 mod file;
 pub use crate::database::file::FileStorage;
 
@@ -49,7 +42,7 @@ pub struct StorageError {
     kind: ErrorKind,
 }
 
-impl From<StorageError> for tide::Response {
+/*impl From<StorageError> for tide::Response {
     fn from(err: StorageError) -> Self {
         tide::Response::builder(match err.kind() {
             ErrorKind::BadRequest => 400,
@@ -66,7 +59,8 @@ impl From<StorageError> for tide::Response {
         }))
         .build()
     }
-}
+}*/
+
 impl std::error::Error for StorageError {
     fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
         self.source
@@ -431,24 +425,7 @@ mod tests {
         );
     }
 
-    /*macro_rules! redis_test {
-        ($func_name:expr) => {
-            paste! {
-                #[cfg(feature="redis")]
-                #[async_std::test]
-                async fn [<redis_ $func_name>] () {
-                    test_logger::ensure_env_logger_initialized();
-                    let redis_instance = get_redis_instance().await;
-                    let backend = super::RedisStorage::new(redis_instance.uri().to_string())
-                        .await
-                        .unwrap();
-                    $func_name(backend).await
-                }
-            }
-        }
-    }*/
-
-    macro_rules! file_test {
+    /*macro_rules! file_test {
         ($func_name:expr) => {
             paste! {
                 #[async_std::test]
@@ -461,13 +438,10 @@ mod tests {
             }
         };
     }
-
-    /*redis_test!(test_backend_basic_operations);
-    redis_test!(test_backend_get_channel_list);
-    redis_test!(test_backend_settings);
-    redis_test!(test_backend_update);*/
+    
     file_test!(test_backend_basic_operations);
     file_test!(test_backend_get_channel_list);
     file_test!(test_backend_settings);
     file_test!(test_backend_update);
+    */
 }