Improve statusing during bulk contacts update

main
Hank Grabowski 2024-12-24 15:33:04 -05:00
rodzic 5bc5fddbe8
commit 9df3d9fb2d
2 zmienionych plików z 16 dodań i 10 usunięć

Wyświetl plik

@ -354,7 +354,11 @@ class AllContactsUpdater extends _$AllContactsUpdater {
.match(onSuccess: (followers) {
for (final f in followers.data) {
originalContacts.remove(f);
results[f.id] = f.copy(status: ConnectionStatus.theyFollowYou);
final c = f.copy(status: ConnectionStatus.theyFollowYou);
results[c.id] = c;
ref
.read(connectionModifierProvider(profile, c).notifier)
.upsertConnection(c);
int id = int.parse(f.id);
maxId = max(maxId, id);
}
@ -362,6 +366,9 @@ class AllContactsUpdater extends _$AllContactsUpdater {
currentPage = followers.next!;
}
moreResults = followers.next != null;
ref
.read(_updateStatusInternalProvider(profile).notifier)
.update('Updating: ${results.length} processed');
}, onError: (error) {
_acuLogger.severe(
'Error getting followers data: $error',
@ -370,12 +377,6 @@ class AllContactsUpdater extends _$AllContactsUpdater {
moreResults = false;
});
for (final c in results.values) {
ref
.read(connectionModifierProvider(profile, c).notifier)
.upsertConnection(c);
}
await Future.delayed(delay);
}
@ -390,9 +391,11 @@ class AllContactsUpdater extends _$AllContactsUpdater {
final newStatus = results.containsKey(f.id)
? ConnectionStatus.mutual
: ConnectionStatus.youFollowThem;
final c = f.copy(status: newStatus);
results[c.id] = c;
ref
.read(connectionModifierProvider(profile, f).notifier)
.upsertConnection(f.copy(status: newStatus));
.read(connectionModifierProvider(profile, c).notifier)
.upsertConnection(c);
int id = int.parse(f.id);
maxId = max(maxId, id);
}
@ -400,6 +403,9 @@ class AllContactsUpdater extends _$AllContactsUpdater {
currentPage = following.next!;
}
moreResults = following.next != null;
ref
.read(_updateStatusInternalProvider(profile).notifier)
.update('Updating: ${results.length} processed');
}, onError: (error) {
_acuLogger.severe(
'Error getting your following data: $error',

Wyświetl plik

@ -1766,7 +1766,7 @@ class _UpdateStatusInternalProviderElement
}
String _$allContactsUpdaterHash() =>
r'40fac002c2cb5d493d034618182a9e1c64b58633';
r'9d5b4f79302f89d8817022dcd9a90af6e05ef949';
abstract class _$AllContactsUpdater extends BuildlessNotifier<bool> {
late final Profile profile;