Skip to content

Commit 9003ad2

Browse files
committed
Last review comments
1 parent 41bf274 commit 9003ad2

File tree

6 files changed

+29
-31
lines changed

6 files changed

+29
-31
lines changed

temporalio/lib/temporalio/client/interceptor.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def intercept_client(next_interceptor)
3737
:start_delay,
3838
:request_eager_start,
3939
:headers,
40-
:priority,
4140
:versioning_override,
4241
:priority,
4342
:rpc_options

temporalio/lib/temporalio/worker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ def initialize(
392392
workflow_payload_codec_thread_pool: nil,
393393
unsafe_workflow_io_enabled: false,
394394
deployment_options: Worker.default_deployment_options,
395-
workflow_task_poller_behavior: SimpleMaximumPollerBehavior.new(maximum: max_concurrent_workflow_task_polls),
396-
activity_task_poller_behavior: SimpleMaximumPollerBehavior.new(maximum: max_concurrent_activity_task_polls),
395+
workflow_task_poller_behavior: PollerBehavior::SimpleMaximum.new(max_concurrent_workflow_task_polls),
396+
activity_task_poller_behavior: PollerBehavior::SimpleMaximum.new(max_concurrent_activity_task_polls),
397397
debug_mode: %w[true 1].include?(ENV['TEMPORAL_DEBUG'].to_s.downcase)
398398
)
399399
raise ArgumentError, 'Must have at least one activity or workflow' if activities.empty? && workflows.empty?

temporalio/lib/temporalio/worker/poller_behavior.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class SimpleMaximum < PollerBehavior
1616
attr_reader :maximum
1717

1818
# @param maximum [Integer] Maximum number of concurrent poll requests.
19-
def initialize(maximum: 5)
19+
def initialize(maximum)
2020
super()
2121
@maximum = maximum
2222
end
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module Temporalio
22
class VersioningOverride
33
def _to_proto: -> untyped
4-
end
54

6-
class Pinned < VersioningOverride
7-
attr_reader version: WorkerDeploymentVersion
5+
class Pinned < VersioningOverride
6+
attr_reader version: WorkerDeploymentVersion
87

9-
def initialize: (WorkerDeploymentVersion version) -> void
10-
def _to_proto: -> untyped
11-
end
8+
def initialize: (WorkerDeploymentVersion version) -> void
9+
def _to_proto: -> untyped
10+
end
1211

13-
class AutoUpgrade < VersioningOverride
14-
def initialize: -> void
15-
def _to_proto: -> untyped
12+
class AutoUpgrade < VersioningOverride
13+
def initialize: -> void
14+
def _to_proto: -> untyped
15+
end
1616
end
1717
end

temporalio/sig/temporalio/worker/poller_behavior.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Temporalio
77
class SimpleMaximum < PollerBehavior
88
attr_reader maximum: Integer
99

10-
def initialize: (?maximum: Integer) -> void
10+
def initialize: (Integer) -> void
1111
def _to_bridge_options: -> Internal::Bridge::Worker::PollerBehaviorSimpleMaximum
1212
end
1313

temporalio/test/worker_test.rb

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -207,23 +207,22 @@ def test_can_run_with_autoscaling_poller_behavior
207207
)
208208
)
209209
worker.run do
210-
# Give pollers a beat to get started
211-
sleep(0.3)
212-
213-
dump = Net::HTTP.get(URI("http://#{prom_addr}/metrics"))
214-
lines = dump.split("\n")
215-
216-
matches = lines.select { |l| l.include?('temporal_num_pollers') }
217-
activity_pollers = matches.select { |l| l.include?('activity_task') }
218-
assert_equal 1, activity_pollers.size
219-
assert activity_pollers[0].end_with?('2')
220-
221-
workflow_pollers = matches.select { |l| l.include?('workflow_task') }
222-
assert_equal 2, workflow_pollers.size
223-
# There's sticky & non-sticky pollers, and they may have a count of 1 or 2 depending on
224-
# initialization timing.
225-
assert(workflow_pollers[0].end_with?('2') || workflow_pollers[0].end_with?('1'))
226-
assert(workflow_pollers[1].end_with?('2') || workflow_pollers[1].end_with?('1'))
210+
assert_eventually do
211+
dump = Net::HTTP.get(URI("http://#{prom_addr}/metrics"))
212+
lines = dump.split("\n")
213+
214+
matches = lines.select { |l| l.include?('temporal_num_pollers') }
215+
activity_pollers = matches.select { |l| l.include?('activity_task') }
216+
assert_equal 1, activity_pollers.size
217+
assert activity_pollers[0].end_with?('2')
218+
219+
workflow_pollers = matches.select { |l| l.include?('workflow_task') }
220+
assert_equal 2, workflow_pollers.size
221+
# There's sticky & non-sticky pollers, and they may have a count of 1 or 2 depending on
222+
# initialization timing.
223+
assert(workflow_pollers[0].end_with?('2') || workflow_pollers[0].end_with?('1'))
224+
assert(workflow_pollers[1].end_with?('2') || workflow_pollers[1].end_with?('1'))
225+
end
227226

228227
handles = Array.new(20) do
229228
env.client.start_workflow(

0 commit comments

Comments
 (0)