fix(benchmark): improve CherryPickAdapter teardown reliability

- Add error handling for scope disposal
- Add null check for _scope variable
- Prevent concurrent modification exceptions
This commit is contained in:
Sergey Penkovsky
2025-08-19 09:22:45 +03:00
parent a897c1b31b
commit ed65e3c23d

View File

@@ -184,9 +184,9 @@ class CherrypickDIAdapter extends DIAdapter<Scope> {
_scope!.resolveAsync<T>(named: named);
@override
void teardown() {
Future<void> teardown() async {
if (!_isSubScope) {
CherryPick.closeRootScope();
await CherryPick.closeRootScope();
_scope = null;
}
// SubScope teardown не требуется