Try and fix exit code issue

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-04-04 16:21:46 -04:00
1 parent 1e6c859539
commit f63d10d003
45 files changed
+301 -229

No files matched your search

@@ -44,7 +44,7 @@ class DynamicBarrier {
}
}
const executeRunnableWith = <Param>(param: Param) => {
const executeRunnableWith = <Param>(tokenId: string, param: Param) => {
const barrier = new DynamicBarrier();
return async (runnable: RunnableWithId<Param>): Promise<void> => {
@@ -52,7 +52,9 @@ const executeRunnableWith = <Param>(param: Param) => {
await barrier.blockOn(parentRunnable.id);
}
console.log(`^^^ "${tokenId}" @ "${runnable.id}"`)
await runnable.run(param);
console.log(`--- "${tokenId}" @ "${runnable.id}"`)
barrier.setFinished(runnable.id);
};
};
@@ -61,7 +63,7 @@ export function runManyFor(di: DiContainerForInjection): RunMany {
const convertToWithId = convertToWithIdWith(di);
return <Param>(injectionToken: InjectionToken<Runnable<Param>, void>) => async (param: Param) => {
const executeRunnable = executeRunnableWith(param);
const executeRunnable = executeRunnableWith(injectionToken.id, param);
const allRunnables = di.injectManyWithMeta(injectionToken).map(x => convertToWithId(x));
verifyRunnablesAreDAG(injectionToken.id, allRunnables);
@@ -12,6 +12,13 @@ export interface Runnable<T = void> {
id?: never;
run: Run<T>;
readonly runAfter?: SingleOrMany<Injectable<Runnable<T>, Runnable<T>, void>>;
/**
* Allows for specifying an black box ordering so that some runnables can be run at the end of the phase in
* a sorted order but after all other ones
*
* NOTE: Must be exclusively set to `runAfter`
*/
readonly afterOrderNumber?: number;
}
export interface RunnableWithId<T> {
@@ -20,6 +27,12 @@ export interface RunnableWithId<T> {
readonly runAfter: RunnableWithId<T>[];
}
export interface AfterRunnableWithId<T> {
run: Run<T>;
readonly id: string;
readonly runAfter: number;
}
export interface RunnableSync<T = void> {
id?: never;
run: RunSync<T>;