[stable-25.0.x] fix(chat): make the push message prefetch actually run on a flaky connection - #6740
Merged
Merged
Conversation
A failed chat pull was retried with a progressively smaller limit (100 -> 50 -> 10 -> 5). For a background catch-up that means a connection which fails a few times before succeeding persists a five message chat block, and since the chat screen renders the latest block, the conversation opens nearly empty even though the prefetch reported success. Keep the requested limit across retries and back off in time instead, so a struggling or rate limiting server is not hammered by four immediate requests either. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
catchUpRoom refused to fetch whenever NetworkMonitor reported the device as offline. That flag is a StateFlow shared while subscribed, and every collector is UI scoped, so a worker started by a push notification reads whatever value was cached when the monitor was constructed and no callback ever updates it. A process that was backgrounded while offline therefore skips every catch-up for as long as it lives, and because the check requires NET_CAPABILITY_VALIDATED it also skips on a connected but unvalidated network, which is exactly the flaky wifi case the prefetch exists for. Drop the pre-check. Callers are already gated by a WorkManager NetworkType.CONNECTED constraint, and a request that fails because the device is offline is reported as a failed sync and retried with backoff, which is strictly better than skipping a fetch that would have succeeded. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
isOnline is exposed as a StateFlow shared while subscribed, so its upstream network callback only runs while something collects it. Reading the value does not subscribe, and every collector in the app is UI scoped, so background code that samples the value - a worker handling a push notification, sending a queued message - sees the value captured when the singleton was constructed and never an update. Share the flow eagerly. The scope already lives for the whole process, so this replaces repeated register and unregister cycles with a single long lived network callback. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
backport/6727/stable-25.0.x
branch
from
September 21, 2026 10:21
6b981ef to
3c56c63
Compare
AndyScherzinger
approved these changes
Sep 21, 2026
AndyScherzinger
marked this pull request as ready for review
September 21, 2026 10:24
The backport of #6694 brought the IOException and HttpException catch clauses into ChatViewModel but not their imports, so stable-25.0.x has not compiled since. Add them back in the same place master keeps them. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/35593076856/artifacts/10635461681 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #6727
Warning, This backport's changes differ from the original and might be incomplete鈿狅笍
Todo
Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.