Skip to content

Commit

Permalink
Fix cases with empty workflow id in schedule API
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jul 2, 2024
1 parent 8da341d commit 70fb234
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Client/Schedule/Action/StartWorkflowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Temporal\Common\IdReusePolicy;
use Temporal\Common\RetryOptions;
use Temporal\Common\TaskQueue\TaskQueue;
use Temporal\Common\Uuid;
use Temporal\DataConverter\EncodedCollection;
use Temporal\DataConverter\EncodedValues;
use Temporal\DataConverter\ValuesInterface;
Expand Down Expand Up @@ -107,7 +108,7 @@ final class StartWorkflowAction extends ScheduleAction

private function __construct(WorkflowType $workflowType)
{
$this->workflowId = '';
$this->workflowId = Uuid::v4();
$this->workflowType = $workflowType;
$this->taskQueue = TaskQueue::new('default');
$this->input = EncodedValues::empty();
Expand All @@ -130,6 +131,8 @@ public static function new(string|WorkflowType $workflowType): self

public function withWorkflowId(string $workflowId): self
{
$workflowId !== '' or throw new \InvalidArgumentException('Workflow ID cannot be empty.');

/** @see self::$workflowId */
return $this->with('workflowId', $workflowId);
}
Expand Down

0 comments on commit 70fb234

Please sign in to comment.