From 6a1aa526198e8049020ba8e6493d3391cdf75a90 Mon Sep 17 00:00:00 2001 From: Yuchen Liang Date: Mon, 2 Dec 2024 16:31:44 +0000 Subject: [PATCH] review: move FlushHandle::handle_error right after ::flush Signed-off-by: Yuchen Liang --- .../src/virtual_file/owned_buffers_io/write/flush.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs b/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs index 7c5c10b918..e77603a7ba 100644 --- a/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs +++ b/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs @@ -175,6 +175,13 @@ where Ok((recycled, flush_control)) } + async fn handle_error(&mut self) -> std::io::Result { + Err(self + .shutdown() + .await + .expect_err("flush task only disconnects duplex if it exits with an error")) + } + /// Cleans up the channel, join the flush task. pub async fn shutdown(&mut self) -> std::io::Result> { let handle = self @@ -192,10 +199,6 @@ where .as_mut() .expect("must not use after we returned an error") } - - async fn handle_error(&mut self) -> std::io::Result { - Err(self.shutdown().await.expect_err("flush task only disconnects duplex if it exits with an error")) - } } /// A background task for flushing data to disk.