From 9ffa76c0f4c8f7f8da874fb197b003de59cdac9b Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 23 Sep 2024 13:29:03 +0200 Subject: [PATCH] as we called startForeground(), longer timeouts should be fine --- .../securesms/service/FetchForegroundService.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java index ddb97310bb..71967f559e 100644 --- a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java +++ b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java @@ -53,16 +53,11 @@ public void onCreate() { startForeground(NotificationCenter.ID_FETCH, notification); - // Start explicit fetch only after we marked ourselves as requiring foreground; - // this may help we on getting network and time adequately - // Fetch is started in background to not block the UI. - // We then run not longer than the max. of 20 seconds, - // see https://firebase.google.com/docs/cloud-messaging/android/receive . Util.runOnAnyBackgroundThread(() -> { Log.i(TAG, "Starting fetch"); - if (!ApplicationContext.dcAccounts.backgroundFetch(19)) { + if (!ApplicationContext.dcAccounts.backgroundFetch(300)) { // as startForeground() was called, there is time FetchForegroundService.stop(this); - } + } // else we stop FetchForegroundService on DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE }); }