update
This commit is contained in:
@@ -45,12 +45,26 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let session_arc = Arc::new(session);
|
||||
println!("Connected to ScyllaDB!");
|
||||
|
||||
// Connect to Redis
|
||||
// Connect to Redis
|
||||
println!("Connecting to Redis...");
|
||||
println!("Verifying new build... REDIS_URI should be used.");
|
||||
let redis_uri = std::env::var("REDIS_URI")
|
||||
.unwrap_or_else(|_| "redis://redis:6379".to_string());
|
||||
let redis_repo = Arc::new(RedisRepository::new(&redis_uri).await?);
|
||||
println!("Connected to Redis!");
|
||||
println!("Using Redis URI: {}", redis_uri);
|
||||
|
||||
let redis_repo = loop {
|
||||
match RedisRepository::new(&redis_uri).await {
|
||||
Ok(repo) => {
|
||||
println!("Connected to Redis!");
|
||||
break Arc::new(repo);
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to connect to Redis: {}. Retrying in 5 seconds...", e);
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Dependency Injection
|
||||
let node_repo = Arc::new(NodeRepository::new(session_arc.clone()));
|
||||
|
||||
Reference in New Issue
Block a user