Skip to content

Commit cf35c43

Browse files
committed
refactor(server): Fix the issue of parallel blocking in server refresh
The original code uses Future.wait to wait for all refresh operations to complete, but in fact, there is no need to wait for the results of these operations. Instead, directly calling ignore() to ignore the results can avoid blocking caused by the slowest server
1 parent f32eaaf commit cf35c43

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/data/provider/server/all.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,10 @@ class ServersNotifier extends _$ServersNotifier {
136136
TryLimiter.reset(id);
137137
}
138138

139-
final refreshFutures = <Future<void>>[];
140139
for (final entry in serversToRefresh) {
141140
final serverNotifier = ref.read(serverProvider(entry.key).notifier);
142-
refreshFutures.add(serverNotifier.refresh());
141+
serverNotifier.refresh().ignore();
143142
}
144-
145-
await Future.wait(refreshFutures);
146143
} finally {
147144
_refreshCompleter = null;
148145
completer.complete();

0 commit comments

Comments
 (0)