Skip to content

Commit 644bb8c

Browse files
authored
Use proper workflow start time in workflow info (#266)
Fixes #255
1 parent 64deb42 commit 644bb8c

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

temporalio/.tool-versions

Lines changed: 0 additions & 1 deletion
This file was deleted.

temporalio/lib/temporalio/internal/worker/workflow_instance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def initialize(details)
149149
end,
150150
run_id: details.initial_activation.run_id,
151151
run_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_run_timeout),
152-
start_time: ProtoUtils.timestamp_to_time(details.initial_activation.timestamp) || raise,
152+
start_time: ProtoUtils.timestamp_to_time(@init_job.start_time) || raise,
153153
task_queue: details.task_queue,
154154
task_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_task_timeout) || raise,
155155
workflow_id: @init_job.workflow_id,

temporalio/lib/temporalio/workflow/info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module Workflow
5454
# @!attribute run_timeout
5555
# @return [Float, nil] Run timeout for the workflow.
5656
# @!attribute start_time
57-
# @return [Time] Time when the workflow started.
57+
# @return [Time] Time when the workflow started on the server.
5858
# @!attribute task_queue
5959
# @return [String] Task queue for the workflow.
6060
# @!attribute task_timeout

temporalio/test/worker_workflow_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def execute
144144
Temporalio::Workflow.info.to_h.tap do |h|
145145
h['parent'] = Temporalio::Workflow.info.parent.to_h if Temporalio::Workflow.info.parent
146146
h['root'] = Temporalio::Workflow.info.root.to_h if Temporalio::Workflow.info.root
147+
h['start_time'] = Temporalio::Workflow.info.start_time.to_s
147148
end
148149
end
149150
end
@@ -158,6 +159,7 @@ def test_info
158159
# Normal info
159160
execute_workflow(InfoWorkflow) do |handle, worker|
160161
info = handle.result #: Hash[String, untyped]
162+
desc = handle.describe
161163
assert_equal 1, info['attempt']
162164
assert_nil info.fetch('continued_run_id')
163165
assert_nil info.fetch('cron_schedule')
@@ -170,7 +172,7 @@ def test_info
170172
assert_nil info.fetch('root')
171173
assert_equal handle.result_run_id, info['run_id']
172174
assert_nil info.fetch('run_timeout')
173-
refute_nil info['start_time']
175+
assert_equal desc.start_time.to_s, info['start_time']
174176
assert_equal worker.task_queue, info['task_queue']
175177
assert_equal 10.0, info['task_timeout']
176178
assert_equal handle.id, info['workflow_id']

0 commit comments

Comments
 (0)