diff --git a/src/connection.rs b/src/connection.rs index 486e6ef..f1635b7 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -395,7 +395,13 @@ impl ConnectionManager { source.username.as_deref(), source.password.as_deref(), ) - .await + .await?; + + // Subscribe to points for this source + self.subscribe_points_from_source(source_id, None, pool) + .await?; + + Ok(()) } pub async fn connect( diff --git a/src/main.rs b/src/main.rs index 2271e63..57c789e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,16 +62,8 @@ async fn main() { let source_id = source.id; let task = tokio::spawn(async move { - match cm.connect_from_source(&p, source_id).await { - Ok(_) => { - // Subscribe to points for this source - if let Err(e) = cm.subscribe_points_from_source(source_id, None, &p).await { - tracing::error!("Failed to subscribe to points for source {}: {}", source_name, e); - } - } - Err(e) => { - tracing::error!("Failed to connect to source {}: {}", source_name, e); - } + if let Err(e) = cm.connect_from_source(&p, source_id).await { + tracing::error!("Failed to connect to source {}: {}", source_name, e); } });