Skip to content

Commit

Permalink
fix: resolve the undefined case
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyPythoneer committed Jul 23, 2024
1 parent f3e1fd9 commit 37c1208
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/worker/orchestration-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,12 @@ export class OrchestrationExecutor {
// since we create an async iterator, we await the creation (so we can use await in the generator itself beside yield)
const result = await fn(ctx, input);

// When a generator is passed this is
// [object AsyncGenerator]
const resultType = result?.toString();

const isAsyncGenerator = typeof result[Symbol.asyncIterator] === 'function';
const isAsyncGenerator = typeof result?.[Symbol.asyncIterator] === 'function';
if (isAsyncGenerator) {
// Start the orchestrator's generator function
await ctx.run(result);
} else {
const resultType = Object.prototype.toString.call(result);
console.log(`An orchestrator was returned that doesn't schedule any tasks (type = ${resultType})`);

// This is an orchestrator that doesn't schedule any tasks
Expand Down

0 comments on commit 37c1208

Please sign in to comment.