mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
api: add APIs to stop background fetch
New APIs are JSON-RPC method stop_background_fetch(), Rust method Accounts.stop_background_fetch() and C method dc_accounts_stop_background_fetch(). These APIs allow to cancel background fetch early even before the initially set timeout, for example on Android when the system calls `Service.onTimeout()` for a `dataSync` foreground service.
This commit is contained in:
@@ -283,6 +283,11 @@ impl CommandApi {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn stop_background_fetch(&self) -> Result<()> {
|
||||
self.accounts.read().await.stop_background_fetch();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
// Methods that work on individual accounts
|
||||
// ---------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user