mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
refactor: remove redundant seams and preserve cleanup ownership (#10375)
* refactor: remove redundant seams and preserve cleanup ownership * fix: validate PE resource extents before budget checks
This commit is contained in:
1 parent
4b26f38d6f
commit
cdc4541ef7
369 files changed
+3847
-3662
No files matched your search
@@ -1754,22 +1754,16 @@ export class BinarySession
|
||||
this.#transitionPending += 1;
|
||||
// Later calls wait for this transition and must not be included in its drain.
|
||||
const admittedThrough = this.#transitionGeneration++;
|
||||
const result = this.#transition.then(
|
||||
() => operation(admittedThrough),
|
||||
() => operation(admittedThrough),
|
||||
);
|
||||
const perform = (): Promise<T> => operation(admittedThrough);
|
||||
const result = this.#transition.then(perform, perform);
|
||||
this.#transition = result.then(
|
||||
() => undefined,
|
||||
() => undefined,
|
||||
);
|
||||
void result.then(
|
||||
() => {
|
||||
this.#transitionPending -= 1;
|
||||
},
|
||||
() => {
|
||||
this.#transitionPending -= 1;
|
||||
},
|
||||
);
|
||||
const finish = (): void => {
|
||||
this.#transitionPending -= 1;
|
||||
};
|
||||
void result.then(finish, finish);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1864,32 +1858,19 @@ export class BinarySession
|
||||
);
|
||||
};
|
||||
signal.addEventListener("abort", onAbort, { once: true });
|
||||
transition.then(
|
||||
() => {
|
||||
signal.removeEventListener("abort", onAbort);
|
||||
resolve(
|
||||
signal.aborted
|
||||
? err(
|
||||
new AnalysisCancelledError(operation, {
|
||||
cause: signal.reason,
|
||||
}),
|
||||
)
|
||||
: ok(undefined),
|
||||
);
|
||||
},
|
||||
() => {
|
||||
signal.removeEventListener("abort", onAbort);
|
||||
resolve(
|
||||
signal.aborted
|
||||
? err(
|
||||
new AnalysisCancelledError(operation, {
|
||||
cause: signal.reason,
|
||||
}),
|
||||
)
|
||||
: ok(undefined),
|
||||
);
|
||||
},
|
||||
);
|
||||
const finish = (): void => {
|
||||
signal.removeEventListener("abort", onAbort);
|
||||
resolve(
|
||||
signal.aborted
|
||||
? err(
|
||||
new AnalysisCancelledError(operation, {
|
||||
cause: signal.reason,
|
||||
}),
|
||||
)
|
||||
: ok(undefined),
|
||||
);
|
||||
};
|
||||
transition.then(finish, finish);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user