@@ -294,12 +294,9 @@ impl Accounts {
294
294
295
295
/// Performs a background fetch for all accounts in parallel.
296
296
///
297
- /// If you need a timeout, then use [Accounts::background_fetch_with_timeout] instead.
298
- ///
299
- /// The `AccountsBackgroundFetchDone` event is emitted at the end,
300
- /// process all events until you get this one and you can safely return to the background
301
- /// without forgeting to create notifications caused by timing race conditions.
302
- pub async fn background_fetch ( & self ) {
297
+ /// This is an auxiliary function and not part of public API.
298
+ /// Use [Accounts::background_fetch] instead.
299
+ async fn background_fetch_without_timeout ( & self ) {
303
300
async fn background_fetch_and_log_error ( account : Context ) {
304
301
if let Err ( error) = account. background_fetch ( ) . await {
305
302
warn ! ( account, "{error:#}" ) ;
@@ -313,19 +310,15 @@ impl Accounts {
313
310
. map ( background_fetch_and_log_error) ,
314
311
)
315
312
. await ;
316
-
317
- self . emit_event ( EventType :: AccountsBackgroundFetchDone ) ;
318
313
}
319
314
320
315
/// Performs a background fetch for all accounts in parallel with a timeout.
321
316
///
322
- /// If you want no timeout, then use [Accounts::background_fetch] instead.
323
- ///
324
317
/// The `AccountsBackgroundFetchDone` event is emitted at the end,
325
318
/// process all events until you get this one and you can safely return to the background
326
319
/// without forgeting to create notifications caused by timing race conditions.
327
- pub async fn background_fetch_with_timeout ( & self , timeout : std:: time:: Duration ) -> Result < ( ) > {
328
- let result = tokio:: time:: timeout ( timeout, self . background_fetch ( ) ) . await ;
320
+ pub async fn background_fetch ( & self , timeout : std:: time:: Duration ) -> Result < ( ) > {
321
+ let result = tokio:: time:: timeout ( timeout, self . background_fetch_without_timeout ( ) ) . await ;
329
322
self . emit_event ( EventType :: AccountsBackgroundFetchDone ) ;
330
323
result. map_err ( |err| err. into ( ) )
331
324
}
0 commit comments