in src/task/RegisteredOrchestrationTask.ts [12:33]
constructor(orchestrationName: string, input?: unknown, instanceId?: string) {
super(false, new CallSubOrchestratorAction(orchestrationName, instanceId, input));
this.withRetry = (retryOptions: RetryOptions): RetryableTask => {
if (this.alreadyScheduled) {
throw new Error(
"Invalid use of `.withRetry`: attempted to create a retriable task from an already scheduled task. " +
`A task with ID ${this.id} to call subOrchestrator ${orchestrationName} has already been scheduled. ` +
"Make sure to only invoke `.withRetry` on tasks that have not previously been yielded."
);
}
const callSubOrchestratorWithRetryAction = new CallSubOrchestratorWithRetryAction(
orchestrationName,
retryOptions,
input,
instanceId
);
const backingTask = new AtomicTask(false, callSubOrchestratorWithRetryAction);
return new RetryableTask(backingTask, retryOptions);
};
}