clarifications around the QueueUninitialized error

This commit is contained in:
Christian Schwarz
2023-05-04 17:08:02 +02:00
parent c025617639
commit 8425b6ab21
2 changed files with 12 additions and 2 deletions

View File

@@ -1404,7 +1404,16 @@ impl Tenant {
// Prevent new uploads from starting.
if let Some(remote_client) = timeline.remote_client.as_ref() {
remote_client.stop()?;
let res = remote_client.stop();
match &res {
Ok(()) => {}
Err(e) => match e {
remote_timeline_client::StopError::QueueUninitialized => {
// This could happen if the timeline is Broken, e.g., because it failed to fetch IndexPart when it was loaded.
}
},
}
res?;
}
// Stop & wait for the remaining timeline tasks, including upload tasks.

View File

@@ -264,7 +264,8 @@ pub enum MaybeDeletedIndexPart {
/// Errors that can arise when calling [`RemoteTimelineClient::stop`].
#[derive(Debug, thiserror::Error)]
pub enum StopError {
/// Callers are responsible for checking this before calling `stop()`.
/// Returned if the upload queue was never initialized.
/// See [`RemoteTimelineClient::init_upload_queue`] and [`RemoteTimelineClient::init_upload_queue_for_empty_remote`].
#[error("queue is not initialized")]
QueueUninitialized,
}