use std::sync::atomic::Ordering;
use crate::action::action_impl;
#[action_impl]
impl Action for crate::action::Shutdown {
type Future = ShutdownFuture;
async fn execute(self) -> () {
self.client.inner.shutdown.pending_drops.close();
if !self.immediate {
self.client.inner.shutdown.pending_drops.wait().await;
}
if !self.client.inner.shutdown.executed.load(Ordering::SeqCst) {
self.client.end_all_sessions().await;
}
self.client.inner.topology.shutdown().await;
self.client
.inner
.shutdown
.executed
.store(true, Ordering::SeqCst);
}
}