Skip to content

Commit 09d9377

Browse files
committed
fixup: conflict
1 parent 882fa7c commit 09d9377

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

crates/core/src/host/host_controller.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use spacetimedb_datastore::db_metrics::data_size::DATA_SIZE_METRICS;
2727
use spacetimedb_datastore::db_metrics::DB_METRICS;
2828
use spacetimedb_datastore::traits::Program;
2929
use spacetimedb_durability::{self as durability, TxOffset};
30-
use spacetimedb_lib::{hash_bytes, ConnectionId, Identity};
30+
use spacetimedb_lib::{hash_bytes, Identity};
3131
use spacetimedb_paths::server::{ReplicaDir, ServerDataDir};
3232
use spacetimedb_paths::FromPathUnchecked;
3333
use spacetimedb_sats::hash::Hash;
@@ -841,48 +841,35 @@ impl Host {
841841
scheduler_starter,
842842
} = launched;
843843

844-
Self::handle_dangling_clients(
845-
&replica_ctx.database_identity,
846-
&module_host,
847-
connected_clients.into_iter(),
848-
)
849-
.await?;
850-
851-
scheduler_starter.start(&module_host)?;
852-
let disk_metrics_recorder_task = tokio::spawn(metric_reporter(replica_ctx.clone())).abort_handle();
853-
854-
Ok(Host {
855-
module: watch::Sender::new(module_host),
856-
replica_ctx,
857-
scheduler,
858-
disk_metrics_recorder_task,
859-
tx_metrics_recorder_task,
860-
})
861-
}
862-
863-
async fn handle_dangling_clients(
864-
database_identity: &Identity,
865-
module_host: &ModuleHost,
866-
connected_clients: impl Iterator<Item = (Identity, ConnectionId)>,
867-
) -> anyhow::Result<()> {
844+
// Disconnect dangling clients.
868845
for (identity, connection_id) in connected_clients {
869846
module_host
870847
.call_identity_disconnected(identity, connection_id)
871848
.await
872849
.with_context(|| {
873850
format!(
874851
"Error calling disconnect for {} {} on {}",
875-
identity, connection_id, database_identity
852+
identity, connection_id, replica_ctx.database_identity
876853
)
877854
})?;
878855
}
879-
880856
// We should have no clients left, but we do this just in case.
881857
// This should only matter if we crashed with something in st_client_credentials,
882858
// then restarted with an older version of the code that doesn't use st_client_credentials.
883859
// That case would cause some permanently dangling st_client_credentials.
884860
// Since we have no clients on startup, this should be safe to do regardless.
885-
module_host.clear_all_clients().await
861+
module_host.clear_all_clients().await?;
862+
863+
scheduler_starter.start(&module_host)?;
864+
let disk_metrics_recorder_task = tokio::spawn(metric_reporter(replica_ctx.clone())).abort_handle();
865+
866+
Ok(Host {
867+
module: watch::Sender::new(module_host),
868+
replica_ctx,
869+
scheduler,
870+
disk_metrics_recorder_task,
871+
tx_metrics_recorder_task,
872+
})
886873
}
887874

888875
/// Construct an in-memory instance of `database` running `program`,

0 commit comments

Comments
 (0)