File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class IsolateDispatcher {
33
33
final _inactiveIsolates = < ReusableIsolate > {};
34
34
35
35
/// A map from active compilationIds to isolates running those compilations.
36
- final _activeIsolates = < int , ReusableIsolate > {};
36
+ final _activeIsolates = < int , Future < ReusableIsolate > > {};
37
37
38
38
/// A pool controlling how many isolates (and thus concurrent compilations)
39
39
/// may be live at once.
@@ -54,8 +54,8 @@ class IsolateDispatcher {
54
54
(compilationId, messageBuffer) = parsePacket (packet);
55
55
56
56
if (compilationId != 0 ) {
57
- var isolate = _activeIsolates[compilationId] ??
58
- await _getIsolate (compilationId);
57
+ var isolate = await _activeIsolates. putIfAbsent (
58
+ compilationId, () => _getIsolate (compilationId! ) );
59
59
try {
60
60
isolate.send (packet);
61
61
return ;
@@ -108,7 +108,6 @@ class IsolateDispatcher {
108
108
_allIsolates.add (isolate);
109
109
}
110
110
111
- _activeIsolates[compilationId] = isolate;
112
111
isolate.checkOut ().listen (_channel.sink.add,
113
112
onError: (Object error, StackTrace stackTrace) {
114
113
if (error is ProtocolError ) {
You can’t perform that action at this time.
0 commit comments