about summary refs log tree commit diff
path: root/src/database/redis/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/redis/mod.rs')
-rw-r--r--src/database/redis/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs
index 00932de..3a0d5fc 100644
--- a/src/database/redis/mod.rs
+++ b/src/database/redis/mod.rs
@@ -10,6 +10,7 @@ use mobc_redis::redis;
 use mobc_redis::redis::AsyncCommands;
 use mobc_redis::RedisConnectionManager;
 use serde_json::json;
+use std::time::Duration;
 
 use crate::database::{ErrorKind, MicropubChannel, Result, Storage, StorageError};
 use crate::indieauth::User;
@@ -292,7 +293,7 @@ impl Storage for RedisStorage {
                                     // Happens because of a broken link (result of an improper deletion?)
                                     None => Ok(None),
                                 },
-                                Err(err) => Err(StorageError::from(err))
+                                Err(err) => Err(StorageError::with_source(ErrorKind::Backend, "Error executing a Redis command", Box::new(err)))
                             }
                         }
                         Err(err) => Err(StorageError::with_source(ErrorKind::Backend, "Error getting a connection from the pool", Box::new(err)))
@@ -360,6 +361,8 @@ impl RedisStorage {
                 redis: Pool::builder()
                     .max_open(20)
                     .max_idle(5)
+                    .get_timeout(Some(Duration::from_secs(3)))
+                    .max_lifetime(Some(Duration::from_secs(120)))
                     .build(RedisConnectionManager::new(client)),
             }),
             Err(e) => Err(e.into()),