File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments