Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow start delay option #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/temporal/connection/grpc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def start_workflow_execution(
headers: nil,
cron_schedule: nil,
memo: nil,
search_attributes: nil
search_attributes: nil,
start_delay: nil
)
request = Temporalio::Api::WorkflowService::V1::StartWorkflowExecutionRequest.new(
identity: identity,
Expand All @@ -139,6 +140,7 @@ def start_workflow_execution(
workflow_execution_timeout: execution_timeout,
workflow_run_timeout: run_timeout,
workflow_task_timeout: task_timeout,
workflow_start_delay: start_delay,
request_id: SecureRandom.uuid,
header: Temporalio::Api::Common::V1::Header.new(
fields: to_payload_map(headers || {})
Expand Down Expand Up @@ -375,7 +377,8 @@ def signal_with_start_workflow_execution(
headers: nil,
cron_schedule: nil,
memo: nil,
search_attributes: nil
search_attributes: nil,
start_delay: nil
)
proto_header_fields = if headers.nil?
to_payload_map({})
Expand All @@ -402,6 +405,7 @@ def signal_with_start_workflow_execution(
workflow_execution_timeout: execution_timeout,
workflow_run_timeout: run_timeout,
workflow_task_timeout: task_timeout,
workflow_start_delay: start_delay,
request_id: SecureRandom.uuid,
header: Temporalio::Api::Common::V1::Header.new(
fields: proto_header_fields
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/lib/temporal/grpc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class TestDeserializer
execution_timeout: 1,
run_timeout: 2,
task_timeout: 3,
start_delay: 10,
memo: {},
search_attributes: {
'foo-int-attribute' => 256,
Expand All @@ -86,6 +87,7 @@ class TestDeserializer
expect(request.workflow_execution_timeout.seconds).to eq(1)
expect(request.workflow_run_timeout.seconds).to eq(2)
expect(request.workflow_task_timeout.seconds).to eq(3)
expect(request.workflow_start_delay.seconds).to eq(10)
expect(request.workflow_id_reuse_policy).to eq(:WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE)
expect(request.search_attributes.indexed_fields).to eq({
'foo-int-attribute' => Temporalio::Api::Common::V1::Payload.new(data: '256', metadata: { 'encoding' => 'json/plain' }),
Expand Down Expand Up @@ -134,6 +136,7 @@ class TestDeserializer
execution_timeout: 1,
run_timeout: 2,
task_timeout: 3,
start_delay: 10,
workflow_id_reuse_policy: :allow,
signal_name: 'the question',
signal_input: 'what do you get if you multiply six by nine?'
Expand All @@ -149,6 +152,7 @@ class TestDeserializer
expect(request.workflow_execution_timeout.seconds).to eq(1)
expect(request.workflow_run_timeout.seconds).to eq(2)
expect(request.workflow_task_timeout.seconds).to eq(3)
expect(request.workflow_start_delay.seconds).to eq(10)
expect(request.signal_name).to eq('the question')
expect(request.signal_input.payloads[0].data).to eq('"what do you get if you multiply six by nine?"')
expect(request.workflow_id_reuse_policy).to eq(:WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE)
Expand Down