mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
rename event also in core
This commit is contained in:
@@ -296,7 +296,7 @@ impl Accounts {
|
||||
///
|
||||
/// If you need a timeout, then use [Accounts::background_fetch_with_timeout] instead.
|
||||
///
|
||||
/// The `BackgroundFetchCompletedForAllAccounts` event is emitted at the end,
|
||||
/// The `AccountsBackgroundFetchDone` event is emitted at the end,
|
||||
/// process all events until you get this one and you can safely return to the background
|
||||
/// without forgeting to create notifications caused by timing race conditions.
|
||||
pub async fn background_fetch(&self) {
|
||||
@@ -314,19 +314,19 @@ impl Accounts {
|
||||
)
|
||||
.await;
|
||||
|
||||
self.emit_event(EventType::BackgroundFetchCompletedForAllAccounts);
|
||||
self.emit_event(EventType::AccountsBackgroundFetchDone);
|
||||
}
|
||||
|
||||
/// Performs a background fetch for all accounts in parallel with a timeout.
|
||||
///
|
||||
/// If you want no timeout, then use [Accounts::background_fetch] instead.
|
||||
///
|
||||
/// The `BackgroundFetchCompletedForAllAccounts` event is emitted at the end,
|
||||
/// The `AccountsBackgroundFetchDone` event is emitted at the end,
|
||||
/// process all events until you get this one and you can safely return to the background
|
||||
/// without forgeting to create notifications caused by timing race conditions.
|
||||
pub async fn background_fetch_with_timeout(&self, timeout: std::time::Duration) -> Result<()> {
|
||||
let result = tokio::time::timeout(timeout, self.background_fetch()).await;
|
||||
self.emit_event(EventType::BackgroundFetchCompletedForAllAccounts);
|
||||
self.emit_event(EventType::AccountsBackgroundFetchDone);
|
||||
result.map_err(|err| err.into())
|
||||
}
|
||||
|
||||
|
||||
@@ -293,5 +293,5 @@ pub enum EventType {
|
||||
/// that all events emitted during the background fetch were processed.
|
||||
///
|
||||
/// This event is only emitted by the account manager
|
||||
BackgroundFetchCompletedForAllAccounts,
|
||||
AccountsBackgroundFetchDone,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user