Skip to content

Commit

Permalink
fix: only instantiate a single broadcaster
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Kolstad <[email protected]>
  • Loading branch information
thomasheartman and chriswk committed Dec 17, 2024
1 parent 39b0a2e commit 5281fd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ async fn main() -> Result<(), anyhow::Error> {
let refresher_for_app_data = feature_refresher.clone();
let prom_registry_for_write = metrics_handler.registry.clone();

#[cfg(feature = "streaming")]
let broadcaster = Broadcaster::new(features_cache.clone());

let server = HttpServer::new(move || {
let qs_config =
serde_qs::actix::QsQueryConfig::default().qs_config(serde_qs::Config::new(5, false));
Expand All @@ -103,7 +106,6 @@ async fn main() -> Result<(), anyhow::Error> {

#[cfg(feature = "streaming")]
{
let broadcaster = Broadcaster::new(features_cache.clone());
app = app.app_data(web::Data::from(broadcaster.clone()));
}
app = match token_validator.clone() {
Expand Down

0 comments on commit 5281fd1

Please sign in to comment.