pub async fn settled(router: &Router)Expand description
Waits until the work the router’s panels run after their responses has finished: the auth mail every request so far left behind is sent or handed to its delivery, or its failure logged.
A panel sends its auth mail once the response has left, so that how long a request takes
tells no one whether an account exists. That work runs beside the server, which stops
waiting for it once its last response is sent. Await this after topcoat::serve_until or
topcoat::start returns, so a shutdown sends the mail already promised:
use std::time::Duration;
// `serving` is `topcoat::serve_until(listener, router.clone(), stop)`.
serving.await?;
if tokio::time::timeout(Duration::from_secs(30), tablo_core::settled(&router))
.await
.is_err()
{
tracing::warn!("stopping with auth mail still unsent");
}tablo::testing::TestClient awaits it after every request, so a test reads the mail a
request sent as soon as the request returns. A router that mounts no panel has no
such work, and this returns at once.