Skip to content

Commit 6188a6b

Browse files
committed
refactor: remove debug logs and simplify dispose function
- Remove console.log debugging statement from plugin - Make dispose function synchronous and remove artificial delay - Add test delays to ensure proper server cleanup - Improve plugin performance and cleanup behavior
1 parent 3293d5e commit 6188a6b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/plugin-code-execution/src/plugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export function createCodeExecutionPlugin(
9090
const needsDefinitions = definitionsOf.filter(
9191
(def) => !hasDefinitions.includes(def),
9292
);
93-
console.log("Needs definitions for:", needsDefinitions);
9493

9594
if (needsDefinitions.length > 0) {
9695
const definitionTexts: string[] = [];
@@ -125,12 +124,10 @@ export function createCodeExecutionPlugin(
125124
);
126125
},
127126

128-
dispose: async () => {
127+
dispose: () => {
129128
if (executor) {
130129
executor.stop();
131130
executor = null;
132-
// Wait for process to terminate
133-
await new Promise((resolve) => setTimeout(resolve, 100));
134131
}
135132
},
136133
};

packages/plugin-code-execution/tests/code_execution.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Deno.test(
3939
assertEquals(result.content.length > 0, true);
4040
} finally {
4141
await server.close?.();
42+
await new Promise((r) => setTimeout(r, 1000));
4243
}
4344
},
4445
);
@@ -76,6 +77,7 @@ Deno.test(
7677
assertEquals(result.content.length > 0, true);
7778
} finally {
7879
await server.close?.();
80+
await new Promise((r) => setTimeout(r, 1000));
7981
}
8082
},
8183
);
@@ -120,6 +122,7 @@ Deno.test(
120122
}
121123
} finally {
122124
await server.close?.();
125+
await new Promise((r) => setTimeout(r, 1000));
123126
}
124127
},
125128
);

0 commit comments

Comments
 (0)