Skip to content

Commit

Permalink
Revert "Don't wait on stream listening in DevTools start up (#3333)"
Browse files Browse the repository at this point in the history
This reverts commit 5058eb0.
  • Loading branch information
elliette authored Sep 10, 2021
1 parent 5058eb0 commit b26541b
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions packages/devtools_app/lib/src/service_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,19 @@ class ServiceConnectionManager {

service.onEvent(serviceStreamName).listen(handleServiceEvent);

_connectedState.value = const ConnectedState(true);

final isolates = [
...vm.isolates,
if (preferences.vmDeveloperModeEnabled.value) ...vm.systemIsolates,
];

await isolateManager.init(isolates);
if (service != this.service) {
// A different service has been opened.
return;
}

final streamIds = [
EventStreams.kDebug,
EventStreams.kExtension,
Expand All @@ -258,9 +271,9 @@ class ServiceConnectionManager {
serviceStreamName,
];

for (final id in streamIds) {
await Future.wait(streamIds.map((String id) async {
try {
unawaited(service.streamListen(id));
await service.streamListen(id);
} catch (e) {
if (id.endsWith('Logging')) {
// Don't complain about '_Logging' or 'Logging' events (new VMs don't
Expand All @@ -272,21 +285,7 @@ class ServiceConnectionManager {
);
}
}
}

if (service != this.service) {
// A different service has been opened.
return;
}

_connectedState.value = const ConnectedState(true);

final isolates = [
...vm.isolates,
if (preferences.vmDeveloperModeEnabled.value) ...vm.systemIsolates,
];

await isolateManager.init(isolates);
}));
if (service != this.service) {
// A different service has been opened.
return;
Expand Down

0 comments on commit b26541b

Please sign in to comment.