mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
api(deltachat-rpc-client): add APIs for background fetch
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ._utils import AttrDict
|
from ._utils import AttrDict, futuremethod
|
||||||
from .account import Account
|
from .account import Account
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -39,6 +39,15 @@ class DeltaChat:
|
|||||||
"""Stop the I/O of all accounts."""
|
"""Stop the I/O of all accounts."""
|
||||||
self.rpc.stop_io_for_all_accounts()
|
self.rpc.stop_io_for_all_accounts()
|
||||||
|
|
||||||
|
@futuremethod
|
||||||
|
def background_fetch(self, timeout_in_seconds: int) -> None:
|
||||||
|
"""Run background fetch for all accounts."""
|
||||||
|
yield self.rpc.background_fetch.future(timeout_in_seconds)
|
||||||
|
|
||||||
|
def stop_background_fetch(self) -> None:
|
||||||
|
"""Stop ongoing background fetch."""
|
||||||
|
self.rpc.stop_background_fetch()
|
||||||
|
|
||||||
def maybe_network(self) -> None:
|
def maybe_network(self) -> None:
|
||||||
"""Indicate that the network conditions might have changed."""
|
"""Indicate that the network conditions might have changed."""
|
||||||
self.rpc.maybe_network()
|
self.rpc.maybe_network()
|
||||||
|
|||||||
Reference in New Issue
Block a user