Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/quayio/scanner/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ def api_call(uri)
response = RestClient.get(
"https://quay.io/api/v1/repository/#{org}/#{repo}#{uri}",
authorization: "Bearer #{quayio_token}",
accept: :json
accept: :json,
open_timeout: 15
)
return JSON.parse(response)
rescue RestClient::ExceptionWithResponse => e
raise e if e.http_code != 520 || attempt >= MAX_ATTEMPTS
rescue RestClient::Exception => e
raise e if attempt >= MAX_ATTEMPTS

# retry later, if we hit cdn rate limiting or on connection errors
raise e unless e.http_code == 520 || e.http_code.nil?
Comment on lines +37 to +38

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Mappt "connection error" 1-zu-1 auf "http_code.nil?" oder führen hier eventuell sogar noch andere Fehlerfälle zu nem Retry?

@stefan-as stefan-as Oct 27, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http_code.nil? bedeutet, dass nix sinnvolles per HTTP zurück gekommen ist. Das würde ich hier gelten lassen als: da ist was schief gegangen, nochmal probieren.


sleep(rand(10))
end
Expand Down