Cooperatively shut down every background task this node owns.
(self)
| 323 | |
| 324 | /// Cooperatively shut down every background task this node owns. |
| 325 | pub async fn shutdown(self) { |
| 326 | self.pg_shutdown_bus.initiate(); |
| 327 | let _ = self.cluster_shutdown_tx.send(true); |
| 328 | let _ = self.poller_shutdown_tx.send(true); |
| 329 | let _ = self.core_stop_tx.send(()); |
| 330 | // Give tokio a chance to drop the task futures before TempDir |
| 331 | // is dropped — otherwise redb file locks can linger. |
| 332 | for _ in 0..32 { |
| 333 | tokio::task::yield_now().await; |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /// Panic-safe teardown. Without this, a test that panics (e.g. a |