Skip to content

Commit

Permalink
Separate options from keyword args in #start_workflow (#117)
Browse files Browse the repository at this point in the history
* Separate options from keyword args in #start_workflow

* fixup! Separate options from keyword args in #start_workflow
  • Loading branch information
antstorm authored Nov 17, 2021
1 parent be42f00 commit 824652b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/temporal/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ def initialize(config)

# Start a workflow with an optional signal
#
# If options[:signal_name] is specified, Temporal will atomically do one of:
# A) start a new workflow and signal it
# B) if workflow_id is specified and the workflow already exists, signal the existing workflow.
# If options[:signal_name] is specified, Temporal will atomically start a new workflow and
# signal it or signal a running workflow (matching a specified options[:workflow_id])
#
# @param workflow [Temporal::Workflow, String] workflow class or name. When a workflow class
# is passed, its config (namespace, task_queue, timeouts, etc) will be used
Expand All @@ -37,8 +36,7 @@ def initialize(config)
# @option options [Hash] :headers
#
# @return [String] workflow's run ID
def start_workflow(workflow, *input, **args)
options = args.delete(:options) || {}
def start_workflow(workflow, *input, options: {}, **args)
input << args unless args.empty?

signal_name = options.delete(:signal_name)
Expand Down Expand Up @@ -101,8 +99,7 @@ def start_workflow(workflow, *input, **args)
# @option options [Hash] :headers
#
# @return [String] workflow's run ID
def schedule_workflow(workflow, cron_schedule, *input, **args)
options = args.delete(:options) || {}
def schedule_workflow(workflow, cron_schedule, *input, options: {}, **args)
input << args unless args.empty?

execution_options = ExecutionOptions.new(workflow, options, config.default_execution_options)
Expand Down Expand Up @@ -160,8 +157,8 @@ def signal_workflow(workflow, signal, workflow_id, run_id, input = nil, namespac
# Long polls for a workflow to be completed and returns workflow's return value.
#
# @note This function times out after 30 seconds and throws Temporal::TimeoutError,
# not to be confused with Temporal::WorkflowTimedOut which reports that the workflow
# itself timed out.
# not to be confused with `Temporal::WorkflowTimedOut` which reports that the workflow
# itself timed out.
#
# @param workflow [Temporal::Workflow, nil] workflow class or nil
# @param workflow_id [String]
Expand Down

0 comments on commit 824652b

Please sign in to comment.