From 4e4f24697f337df85eea131ee9499e92988b678f Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 4 Apr 2024 14:58:11 +0000 Subject: [PATCH] fixup switch to heavier_once_cell: undo changes related to no need for async fns --- pageserver/src/http/routes.rs | 2 +- pageserver/src/tenant.rs | 12 ++++-------- pageserver/src/walredo.rs | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs index 36f80eb3ccc1..47d8ae114891 100644 --- a/pageserver/src/http/routes.rs +++ b/pageserver/src/http/routes.rs @@ -1028,7 +1028,7 @@ async fn tenant_status( attachment_status: state.attachment_status(), generation: tenant.generation().into(), }, - walredo: tenant.wal_redo_manager_status().await, + walredo: tenant.wal_redo_manager_status(), timelines: tenant.list_timeline_ids(), }) } diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 62ea83905d53..17ff033e00c5 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -384,9 +384,9 @@ impl WalRedoManager { } } - pub(crate) async fn status(&self) -> Option { + pub(crate) fn status(&self) -> Option { match self { - WalRedoManager::Prod(m) => m.status().await, + WalRedoManager::Prod(m) => m.status(), #[cfg(test)] WalRedoManager::Test(_) => None, } @@ -1683,12 +1683,8 @@ impl Tenant { self.generation } - pub(crate) async fn wal_redo_manager_status(&self) -> Option { - if let Some(mgr) = self.walredo_mgr.as_ref() { - mgr.status().await - } else { - None - } + pub(crate) fn wal_redo_manager_status(&self) -> Option { + self.walredo_mgr.as_ref().and_then(|mgr| mgr.status()) } /// Changes tenant status to active, unless shutdown was already requested. diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index 32516cf2be8a..ca41a576fd36 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -139,7 +139,7 @@ impl PostgresRedoManager { } } - pub(crate) async fn status(&self) -> Option { + pub(crate) fn status(&self) -> Option { Some(WalRedoManagerStatus { last_redo_at: { let at = *self.last_redo_at.lock().unwrap();