Skip to content

Commit

Permalink
chore(1-3217): run in a neverending loop (#615)
Browse files Browse the repository at this point in the history
Instead of using `while let Ok(...)` To run the listening loop, we'll just use a plain old loop. This is an experiment to see if this'll make it always reconnect successfully.
  • Loading branch information
thomasheartman authored Dec 20, 2024
1 parent 2171000 commit 435ef59
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/src/http/feature_refresher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,16 @@ impl FeatureRefresher {
})
.map_err(|e| warn!("Error in SSE stream: {:?}", e));

while let Ok(Some(handler)) = stream.try_next().await {
handler.await;
loop {
match stream.try_next().await {
Ok(Some(handler)) => handler.await,
Ok(None) => {
info!("SSE stream ended? Handler was None, anyway. Reconnecting.");
}
Err(e) => {
info!("SSE stream error: {e:?}. Reconnecting");
}
}
}
});
}
Expand Down

0 comments on commit 435ef59

Please sign in to comment.