Skip to content

Commit d6c24eb

Browse files
link2xtr10s
authored andcommitted
Make Accounts::background_fetch() not return Result
1 parent f7fd1ef commit d6c24eb

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

deltachat-ffi/src/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4915,19 +4915,11 @@ pub unsafe extern "C" fn dc_accounts_background_fetch(
49154915
let accounts = &*accounts;
49164916
block_on(async move {
49174917
let accounts = accounts.read().await;
4918-
match accounts
4918+
accounts
49194919
.background_fetch(Duration::from_secs(timeout_in_seconds))
4920-
.await
4921-
{
4922-
Ok(()) => 1,
4923-
Err(err) => {
4924-
accounts.emit_event(EventType::Error(format!(
4925-
"Failed to do background fetch: {err:#}"
4926-
)));
4927-
0
4928-
}
4929-
}
4930-
})
4920+
.await;
4921+
});
4922+
1
49314923
}
49324924

49334925
#[no_mangle]

deltachat-jsonrpc/src/api.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,15 @@ impl CommandApi {
233233

234234
/// Performs a background fetch for all accounts in parallel with a timeout.
235235
///
236-
/// The `AccountsBackgroundFetchDone` event is emitted at the end
237-
/// if the method returns sucessfully, even in case of timeout.
236+
/// The `AccountsBackgroundFetchDone` event is emitted at the end even in case of timeout.
238237
/// Process all events until you get this one and you can safely return to the background
239238
/// without forgetting to create notifications caused by timing race conditions.
240239
async fn accounts_background_fetch(&self, timeout_in_seconds: f64) -> Result<()> {
241240
self.accounts
242241
.write()
243242
.await
244243
.background_fetch(std::time::Duration::from_secs_f64(timeout_in_seconds))
245-
.await?;
244+
.await;
246245
Ok(())
247246
}
248247

src/accounts.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ impl Accounts {
317317
/// The `AccountsBackgroundFetchDone` event is emitted at the end,
318318
/// process all events until you get this one and you can safely return to the background
319319
/// without forgetting to create notifications caused by timing race conditions.
320-
///
321-
/// On error no `AccountsBackgroundFetchDone` event is emitted.
322-
pub async fn background_fetch(&self, timeout: std::time::Duration) -> Result<()> {
320+
pub async fn background_fetch(&self, timeout: std::time::Duration) {
323321
if let Err(_err) =
324322
tokio::time::timeout(timeout, self.background_fetch_without_timeout()).await
325323
{
@@ -328,7 +326,6 @@ impl Accounts {
328326
));
329327
}
330328
self.emit_event(EventType::AccountsBackgroundFetchDone);
331-
Ok(())
332329
}
333330

334331
/// Emits a single event.

0 commit comments

Comments
 (0)