Skip to content

Commit

Permalink
Retry until available.
Browse files Browse the repository at this point in the history
  • Loading branch information
aantix committed May 16, 2023
1 parent 7808fad commit e70d072
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/integration/thread_safety_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ class ThreadSafetyTest < ActionDispatch::IntegrationTest

::Callstacking::Rails::Trace.trace_log.each do |trace_id, url|
params = url.gsub(TEST_URL, '')
response = client.show(trace_id)
json = response.body

# Retry until the trace is available
retry_count = 0
json = {'trace_entries' => []}
while json['trace_entries'].empty? && retry_count <= 50
response = client.show(trace_id)
json = response.body

sleep 1
retry_count+=1
end

::Callstacking::Rails::Logger.log "url: #{url} -- json: #{json.inspect}"

Expand Down

0 comments on commit e70d072

Please sign in to comment.