diff --git a/deltachat-jsonrpc/src/api.rs b/deltachat-jsonrpc/src/api.rs index 61d4fe7c1..74165e305 100644 --- a/deltachat-jsonrpc/src/api.rs +++ b/deltachat-jsonrpc/src/api.rs @@ -323,7 +323,7 @@ impl CommandApi { /// I/O must be started for this request to take effect. async fn clear_all_relay_storage(&self, account_id: u32) -> Result<()> { let ctx = self.get_context(account_id).await?; - ctx.clear_all_relay_storage().await; + ctx.clear_all_relay_storage().await?; Ok(()) } diff --git a/src/context.rs b/src/context.rs index c32a3add4..e6347c29d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -565,8 +565,8 @@ impl Context { /// Non-chatmail relays are excluded /// to avoid accidentally deleting emails /// from shared inboxes. - pub async fn clear_all_relay_storage(&self) { - self.scheduler.clear_all_relay_storage().await; + pub async fn clear_all_relay_storage(&self) -> Result<()> { + self.scheduler.clear_all_relay_storage().await } /// Restarts the IO scheduler if it was running before diff --git a/src/scheduler.rs b/src/scheduler.rs index 0ae6c6ac3..4710f7847 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -256,10 +256,13 @@ impl SchedulerState { } } - pub(crate) async fn clear_all_relay_storage(&self) { + pub(crate) async fn clear_all_relay_storage(&self) -> Result<()> { let inner = self.inner.read().await; if let InnerSchedulerState::Started(ref scheduler) = *inner { scheduler.clear_all_relay_storage(); + Ok(()) + } else { + bail!("IO is not started"); } }