fix: Valkey health check uses nc first (avoids password hang)
All checks were successful
BotServer CI/CD / build (push) Successful in 3m58s
All checks were successful
BotServer CI/CD / build (push) Successful in 3m58s
- nc -z checks port connectivity instantly (no auth needed) - valkey-cli ping as fallback (hangs when password required) - Fixes bootstrap hang on production where Valkey has Vault password
This commit is contained in:
parent
c26e483cc9
commit
318367d439
1 changed files with 13 additions and 19 deletions
|
|
@ -119,6 +119,18 @@ pub fn vault_health_check() -> bool {
|
|||
|
||||
/// Check if Valkey/Redis cache is healthy
|
||||
pub fn cache_health_check() -> bool {
|
||||
match SafeCommand::new("nc")
|
||||
.and_then(|c| c.args(&["-z", "-w", "1", "127.0.0.1", "6379"]))
|
||||
.and_then(|c| c.execute())
|
||||
{
|
||||
Ok(output) => {
|
||||
if output.status.success() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
|
||||
let stack_path =
|
||||
std::env::var("BOTSERVER_STACK_PATH").unwrap_or_else(|_| "./botserver-stack".to_string());
|
||||
let valkey_cli = format!("{}/bin/cache/bin/valkey-cli", stack_path);
|
||||
|
|
@ -135,25 +147,7 @@ pub fn cache_health_check() -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
if let Ok(output) = SafeCommand::new("redis-cli")
|
||||
.and_then(|c| c.args(&["-h", "127.0.0.1", "-p", "6379", "ping"]))
|
||||
.and_then(|c| c.execute())
|
||||
{
|
||||
if output.status.success() {
|
||||
let response = String::from_utf8_lossy(&output.stdout);
|
||||
if response.trim().to_uppercase() == "PONG" {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match SafeCommand::new("nc")
|
||||
.and_then(|c| c.args(&["-z", "-w", "1", "127.0.0.1", "6379"]))
|
||||
.and_then(|c| c.execute())
|
||||
{
|
||||
Ok(output) => output.status.success(),
|
||||
Err(_) => false,
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// Check if Qdrant vector database is healthy
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue