Skip to content

Commit 93baff3

Browse files
committed
fix: rubocop
1 parent aac72b1 commit 93baff3

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

spec/channel_batch_updater_spec.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ def fetch_task_with_retry(task_id, attempt)
2323
nil
2424
end
2525

26+
def transient_failure?(task)
27+
result = task['result']
28+
return true if result.nil? || (result.is_a?(Hash) && result.empty?)
29+
30+
rate_limit_error?(task)
31+
end
32+
2633
def wait_for_task(task_id, timeout_seconds: 120)
2734
sleep(2) # Initial delay
2835

@@ -38,15 +45,9 @@ def wait_for_task(task_id, timeout_seconds: 120)
3845
when 'completed'
3946
return task
4047
when 'failed'
41-
# If result is empty, continue polling (matches Go behavior)
42-
result = task['result']
43-
if result.nil? || (result.is_a?(Hash) && result.empty?)
44-
sleep(2)
45-
elsif rate_limit_error?(task)
46-
sleep(2)
47-
else
48-
raise "Task failed with result: #{task['result']}"
49-
end
48+
raise "Task failed with result: #{task['result']}" unless transient_failure?(task)
49+
50+
sleep(2)
5051
end
5152
end
5253

0 commit comments

Comments
 (0)