Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix pull ab twice in log (#11699)

21pages9dbb6217f7c9
diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dart
index 5efbd9e5f..390150505 100644
--- a/flutter/lib/models/ab_model.dart
+++ b/flutter/lib/models/ab_model.dart
@@ -775,7 +775,10 @@ abstract class BaseAb {
final pullError = "".obs;
final pushError = "".obs;
- final abLoading = false.obs;
+ final abLoading = false
+ .obs; // Indicates whether the UI should show a loading state for the address book.
+ var abPulling =
+ false; // Tracks whether a pull operation is currently in progress to prevent concurrent pulls. Unlike abLoading, this is not tied to UI updates.
bool initialized = false;
String name();
@@ -790,17 +793,22 @@ abstract class BaseAb {
}
Future<void> pullAb({quiet = false}) async {
- debugPrint("pull ab \"${name()}\"");
- if (abLoading.value) return;
+ if (abPulling) return;
+ abPulling = true;
if (!quiet) {
abLoading.value = true;
pullError.value = "";
}
initialized = false;
+ debugPrint("pull ab \"${name()}\"");
try {
initialized = await pullAbImpl(quiet: quiet);
- } catch (_) {}
- abLoading.value = false;
+ } catch (e) {
+ debugPrint("Error occurred while pulling address book: $e");
+ } finally {
+ abLoading.value = false;
+ abPulling = false;
+ }
}
Future<bool> pullAbImpl({quiet = false});