Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dwds] Add unbatching retry mechanism for failing batched expression evals #2552

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Update to be forward compatible with changes to `package:shelf_web_socket`.
- Added support for some debugging APIs with the DDC library bundle format. - [#2537](https://github.com/dart-lang/webdev/issues/2537),[#2544](https://github.com/dart-lang/webdev/issues/2544)
- Fix issue where batched expression evals were failing if any subexpression failed. - [#2551](https://github.com/dart-lang/webdev/issues/2551)

## 24.2.0

Expand Down
53 changes: 26 additions & 27 deletions dwds/lib/src/services/batched_expression_evaluator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,38 +134,37 @@ class BatchedExpressionEvaluator extends ExpressionEvaluator {
first.scope,
);

final listId = list.objectId;
if (listId == null) {
for (final request in requests) {
safeUnawaited(_evaluateBatch([request]));
}
return;
}

for (var i = 0; i < requests.length; i++) {
final request = requests[i];
if (request.completer.isCompleted) continue;
_logger.fine('Getting result out of a batch for ${request.expression}');

final listId = list.objectId;
if (listId == null) {
final error = createError(
EvaluationErrorKind.internal,
'No batch result object ID.',
);
request.completer.complete(error);
} else {
safeUnawaited(
_inspector
.getProperties(
listId,
offset: i,
count: 1,
length: requests.length,
)
.then((v) {
final result = v.first.value!;
_logger.fine(
'Got result out of a batch for ${request.expression}: $result',
);
request.completer.complete(result);
}),
onError: (error, stackTrace) =>
request.completer.completeError(error, stackTrace),
);
}
safeUnawaited(
_inspector
.getProperties(
listId,
offset: i,
count: 1,
length: requests.length,
)
.then((v) {
final result = v.first.value!;
_logger.fine(
'Got result out of a batch for ${request.expression}: $result',
);
request.completer.complete(result);
}),
onError: (error, stackTrace) =>
request.completer.completeError(error, stackTrace),
);
}
}
}
Loading