## Summary - Increases the retry delays in `_resolveDatabasePath()` from `[100, 300, 600]` ms (~1 s) to `[200, 500, 1000, 2000]` ms (~3.7 s). - Adds a regression test (`test/unit/database_path_test.dart`) that verifies `initDatabasePath()` does not throw when the `path_provider` channel is unavailable. ## Root cause On some slow Android devices (e.g. the Motorola reported in #166), the `path_provider` Pigeon channel is not ready even several seconds after `runApp()` returns. The previous back-off budget of ~1 s was not enough, causing `_resolveDatabasePath()` to exhaust all retries and throw a `PlatformException`, crashing the app with the message shown in the issue. ## Test plan - [ ] `flutter test test/unit/database_path_test.dart` passes (new regression test) - [ ] `flutter test test/unit/` — all 325 unit tests pass - [ ] `flutter analyze` — no issues Fixes #166 Co-authored-by: Thomas SharedInbox <sharedinbox@thomas-guettler.de> Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/169
This commit was merged in pull request #169.
This commit is contained in:
committed by
guettli
co-authored by
guettli
Thomas SharedInbox
parent
47824c5711
commit
77fc6964f6
@@ -596,8 +596,10 @@ Future<void> initDatabasePath() async {
|
||||
Future<String> _resolveDatabasePath() async {
|
||||
if (_dbPath != null) return _dbPath!;
|
||||
// initDatabasePath() failed (channel not ready before runApp). Retry now
|
||||
// that the engine is fully initialised, with brief back-off.
|
||||
const delays = [100, 300, 600];
|
||||
// that the engine is fully initialised, with back-off. Some slow Android
|
||||
// devices need several seconds for the Pigeon channel to become ready
|
||||
// (issue #166), so use a longer schedule than the initial attempt.
|
||||
const delays = [200, 500, 1000, 2000];
|
||||
for (final ms in delays) {
|
||||
try {
|
||||
final dir = await getApplicationSupportDirectory();
|
||||
|
||||
Reference in New Issue
Block a user