Skip to content

Commit 906067f

Browse files
committed
Update scopes.rb
1 parent 2f30e45 commit 906067f

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

libs/platforms/bugcrowd/scopes.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,21 @@ def self.fetch_group_targets(targets_url)
218218
# @param resource_type [String] Description of what's being fetched for logging
219219
# @return [HTTP::Response, nil] Response object or nil if request failed
220220
def self.fetch_with_logging(url, resource_type)
221-
response = HttpClient.get(url)
222-
unless valid_response?(response)
223-
Discord.log_warn("Bugcrowd - Failed to fetch #{resource_type}: #{url}")
224-
return nil
221+
retries = 0
222+
max_retries = 2
223+
224+
loop do
225+
response = HttpClient.get(url)
226+
return response if valid_response?(response)
227+
228+
retries += 1
229+
if retries <= max_retries
230+
sleep 3 # Sleep for 3 seconds before retrying
231+
else
232+
Discord.log_warn("Bugcrowd - Failed to fetch #{resource_type}: #{url} after #{max_retries} retries")
233+
return nil
234+
end
225235
end
226-
response
227236
end
228237

229238
# Helper method for parsing JSON with error logging

0 commit comments

Comments
 (0)