(&self)
| 3451 | } |
| 3452 | |
| 3453 | async fn probe_ready(&self) -> Result<()> { |
| 3454 | let mut config = tokio_postgres::Config::new(); |
| 3455 | configure_native_postgres_client(&mut config, self); |
| 3456 | let (client, connection) = config |
| 3457 | .connect(tokio_postgres::NoTls) |
| 3458 | .await |
| 3459 | .context("connect readiness probe")?; |
| 3460 | let connection_task = tokio::spawn(async move { |
| 3461 | let _ = connection.await; |
| 3462 | }); |
| 3463 | let query_result = client |
| 3464 | .simple_query("SELECT 1") |
| 3465 | .await |
| 3466 | .context("run readiness probe query"); |
| 3467 | drop(client); |
| 3468 | connection_task.abort(); |
| 3469 | query_result.map(|_| ()) |
| 3470 | } |
| 3471 | } |
| 3472 | |
| 3473 | fn configure_native_postgres_client(config: &mut tokio_postgres::Config, native: &NativePostgres) { |
no test coverage detected