Skip to content

Commit

Permalink
fix: check async generator (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyPythoneer authored Jul 22, 2024
1 parent df277ac commit f3e1fd9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/worker/orchestration-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,8 @@ export class OrchestrationExecutor {
// [object AsyncGenerator]
const resultType = result?.toString();

// Try to extract AsyncGenerator
const match = /\[object (\w+)\]/.exec(resultType);
const resultTypeName = (match && match[1]) ?? "";

// Check if the result is a generator
if (resultTypeName.indexOf("Generator") > -1) {
const isAsyncGenerator = typeof result[Symbol.asyncIterator] === 'function';
if (isAsyncGenerator) {
// Start the orchestrator's generator function
await ctx.run(result);
} else {
Expand Down

0 comments on commit f3e1fd9

Please sign in to comment.