@@ -2,7 +2,7 @@ use crate::services::config::DatabaseConfig;
22use anyhow:: { Context , Result } ;
33use tokio:: process:: Command ;
44use tokio:: time:: { Duration , timeout} ;
5- use tracing:: { debug, info} ;
5+ use tracing:: { debug, info, error } ;
66
77pub async fn run ( cfg : DatabaseConfig ) -> Result < bool > {
88 let mut cmd = Command :: new ( "valkey-cli" ) ;
@@ -21,33 +21,34 @@ pub async fn run(cfg: DatabaseConfig) -> Result<bool> {
2121
2222 cmd. arg ( "PING" ) ;
2323
24- debug ! ( "Command Ping: {:?}" , cmd) ;
24+ debug ! ( "Command Ping Valkey : {:?}" , cmd) ;
2525
2626 let result = timeout ( Duration :: from_secs ( 10 ) , cmd. output ( ) ) . await ;
2727
2828 match result {
2929 Ok ( output) => {
30- let output = output. context ( "Failed to execute redis -cli" ) ?;
30+ let output = output. context ( "Failed to execute valkey -cli" ) ?;
3131 let stdout = String :: from_utf8_lossy ( & output. stdout ) ;
3232 let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
3333
34- info ! ( "Redis stdout: {}" , stdout) ;
35- info ! ( "Redis stderr: {}" , stderr) ;
34+ if !stdout. is_empty ( ) {
35+ error ! ( "Valkey stderr: {}" , stderr) ;
36+ }
3637
3738 if stderr. contains ( "NOAUTH" ) {
38- info ! ( "Redis authentication failed (NOAUTH required)" ) ;
39+ error ! ( "Valkey authentication failed (NOAUTH required)" ) ;
3940 return Ok ( false ) ;
4041 }
4142
4243 if !output. status . success ( ) {
43- info ! ( "Redis command failed with status: {:?}" , output. status) ;
44+ error ! ( "Valkey command failed with status: {:?}" , output. status) ;
4445 return Ok ( false ) ;
4546 }
4647
4748 Ok ( stdout. contains ( "PONG" ) )
4849 }
4950 Err ( _) => {
50- info ! ( "Timeout connecting to Redis at {}:{}" , cfg. host, cfg. port) ;
51+ info ! ( "Timeout connecting to Valkey at {}:{}" , cfg. host, cfg. port) ;
5152 Ok ( false )
5253 }
5354 }
0 commit comments