Skip to content

Commit 0b94a2a

Browse files
author
swaroopakkineni
committed
Fix linting issues in client_retry_spec.rb variable names
1 parent 4aea845 commit 0b94a2a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

lib/workos/audit_logs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_event(organization:, event:, idempotency_key: nil)
3232
},
3333
)
3434

35-
execute_request(request: request)
35+
execute_request(request: request, retries: 3)
3636
end
3737

3838
# Create an Export of Audit Log Events.

lib/workos/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def client
1515
end
1616

1717
# rubocop:disable Metrics/AbcSize
18-
def execute_request(request:)
19-
retries = WorkOS.config.max_retries
18+
def execute_request(request:, retries: nil)
19+
retries = retries.nil? ? WorkOS.config.max_retries : retries
2020
attempt = 0
2121

2222
begin

lib/workos/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Configuration
77

88
def initialize
99
@timeout = 60
10-
@max_retries = 3
10+
@max_retries = 0
1111
end
1212

1313
def key!

spec/lib/workos/client_retry_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,27 +195,27 @@ def self.test_request
195195
# Allow rand to return a consistent value for testing
196196
allow_any_instance_of(Object).to receive(:rand).and_return(0.5)
197197

198-
backoff_attempt_1 = test_module.send(:calculate_backoff, 1)
199-
backoff_attempt_2 = test_module.send(:calculate_backoff, 2)
200-
backoff_attempt_3 = test_module.send(:calculate_backoff, 3)
198+
backoff_attempt1 = test_module.send(:calculate_backoff, 1)
199+
backoff_attempt2 = test_module.send(:calculate_backoff, 2)
200+
backoff_attempt3 = test_module.send(:calculate_backoff, 3)
201201

202202
# Attempt 1: base_delay * 2^0 = 1.0, jitter = 0.125
203-
expect(backoff_attempt_1).to eq(1.125)
203+
expect(backoff_attempt1).to eq(1.125)
204204

205205
# Attempt 2: base_delay * 2^1 = 2.0, jitter = 0.25
206-
expect(backoff_attempt_2).to eq(2.25)
206+
expect(backoff_attempt2).to eq(2.25)
207207

208208
# Attempt 3: base_delay * 2^2 = 4.0, jitter = 0.5
209-
expect(backoff_attempt_3).to eq(4.5)
209+
expect(backoff_attempt3).to eq(4.5)
210210
end
211211

212212
it 'respects max_delay' do
213213
allow_any_instance_of(Object).to receive(:rand).and_return(0.5)
214214

215-
backoff_attempt_10 = test_module.send(:calculate_backoff, 10)
215+
backoff_attempt10 = test_module.send(:calculate_backoff, 10)
216216

217217
# Should cap at 30.0 + jitter (30.0 * 0.25 * 0.5 = 3.75)
218-
expect(backoff_attempt_10).to eq(33.75)
218+
expect(backoff_attempt10).to eq(33.75)
219219
end
220220
end
221221

0 commit comments

Comments
 (0)