jsonrpc: auto restart io on setConfig for the following keys sentbox_watch, mvbox_move and only_fetch_mvbox (#3542)

Co-authored-by: Jikstra <34889164+Jikstra@users.noreply.github.com>
This commit is contained in:
Simon Laux
2022-08-18 16:27:03 +02:00
committed by GitHub
parent 8be5ca6c30
commit 7d97ab2731
3 changed files with 22 additions and 2 deletions

View File

@@ -239,6 +239,17 @@ impl Context {
}
}
/// Restarts the IO scheduler if it was running before
/// when it is not running this is an no-op
pub async fn restart_io_if_running(&self) {
info!(self, "restarting IO");
let is_running = { self.inner.scheduler.read().await.is_some() };
if is_running {
self.stop_io().await;
self.start_io().await;
}
}
/// Returns a reference to the underlying SQL instance.
///
/// Warning: this is only here for testing, not part of the public API.