Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/client/device_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,18 +988,6 @@ impl Client {
devices
}

/// Background loop placeholder for device registry cleanup.
/// Note: Cleanup functionality was removed as part of trait simplification.
/// Device registry entries are managed through normal update/get operations.
pub(super) async fn device_registry_cleanup_loop(&self) {
// Simply wait for shutdown signal
self.shutdown_notifier.listen().await;
debug!(
target: "Client/DeviceRegistry",
"Shutdown signaled, exiting cleanup loop"
);
}

/// Migrate device registry entries from PN key to LID key.
#[cfg_attr(
feature = "tracing",
Expand Down
8 changes: 0 additions & 8 deletions src/client/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,6 @@ impl Client {
}))
.detach();

// Start background task to clean up stale device registry entries
let cleanup_arc = arc.clone();
arc.runtime
.spawn(Box::pin(async move {
cleanup_arc.device_registry_cleanup_loop().await;
}))
.detach();

(arc, rx)
}

Expand Down
22 changes: 22 additions & 0 deletions src/client/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3409,6 +3409,28 @@ async fn terminal_disconnect_propagates_to_per_connection_signal() {
);
}

/// Dropping the last owner must release persistence handles promptly.
#[tokio::test]
async fn dropping_fresh_client_releases_it_without_shutdown() {
let client = crate::test_utils::create_test_client().await;
let weak = Arc::downgrade(&client);

drop(client);

tokio::time::timeout(Duration::from_secs(5), async {
while weak.strong_count() != 0 {
tokio::task::yield_now().await;
}
})
.await
.unwrap_or_else(|_| {
panic!(
"client is still retained by a background task (strong_count={})",
weak.strong_count()
)
});
}

/// Locks the zero-allocation property of the ack miss path: id resolution and
/// the waiter probe must borrow from the node buffer. An `into_owned()` here
/// costs one String per received ack, which the e2e dhat profile caught live.
Expand Down
Loading