File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ async fn connect_to_redis(args: &Args) -> anyhow::Result<ConnectionManager> {
106106 let client = redis:: Client :: open ( args. redis_dsn . clone ( ) ) ?;
107107 let config = ConnectionManagerConfig :: default ( )
108108 . set_connection_timeout ( Some ( args. redis_connection_timeout ) )
109- . set_max_delay ( args. redis_reconnection_max_delay ) ;
109+ . set_max_delay ( args. redis_reconnection_max_delay )
110+ . set_response_timeout ( args. redis_response_timeout ) ;
110111 let con = timeout (
111112 args. redis_connection_timeout ,
112113 redis:: aio:: ConnectionManager :: new_with_config ( client, config) ,
Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ pub struct Args {
8686 ) ]
8787 pub redis_reconnection_max_delay : Duration ,
8888
89+ /// The timeout for redis requets
90+ #[ arg(
91+ long,
92+ value_name = "REDIS_RESPONSE_TIMEOUT" ,
93+ env = "HAKANAI_REDIS_RESPONSE_TIMEOUT" ,
94+ value_parser = humantime:: parse_duration
95+ ) ]
96+ pub redis_response_timeout : Option < Duration > ,
97+
8998 #[ arg(
9099 long,
91100 value_name = "STATS_TTL" ,
@@ -328,6 +337,7 @@ mod tests {
328337 one_time_token_ttl : Duration :: from_secs ( 604800 ) ,
329338 redis_connection_timeout : Duration :: from_secs ( 10 ) ,
330339 redis_reconnection_max_delay : Duration :: from_millis ( 10 ) ,
340+ redis_response_timeout : None ,
331341 }
332342 }
333343
You can’t perform that action at this time.
0 commit comments