Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry quay.io request on 520 responses #5

Merged
merged 1 commit into from
Jan 31, 2020
Merged

Conversation

stefan-as
Copy link
Contributor

No description provided.

Copy link
Contributor

@bennibu bennibu left a comment

Choose a reason for hiding this comment

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

Nice. Mit ein paar Kommentaren zurück. Sonst sieht das aber gut aus finde ich.

accept: :json)
rescue RestClient::ExceptionWithResponse => err
return nil if err.http_code == 404 # ignore unknown repos
if err.http_code == 520 and attempt < MAX_ATTEMPTS
Copy link
Contributor

Choose a reason for hiding this comment

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

Warum versucht ihr es nur bei 520? Das ist ja sogar ein Spezialfall von Cloudflare. Warum nehmt ihr nicht einfach alle 500?

Suggested change
if err.http_code == 520 and attempt < MAX_ATTEMPTS
if err.http_code >= 500 and attempt < MAX_ATTEMPTS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, gute Frage, ich bin unentschlossen. Uns nervt gerade der 520, weil wir wissen, dass das ein temporäres Problem ist und das weggeht, wenn zu einem späteren Zeitpunkt ein erneuter Request kommt. Andere 500 haben wir nicht gesehen und wir wissen auch nicht, wie dann die Situation aussieht. Daher würde ich für den Moment abwarten, bis wir in eine solche Situation kommen und dann bewerten, ob wir alle 500 abfangen.

rescue RestClient::ExceptionWithResponse => err
return nil if err.http_code == 404 # ignore unknown repos
if err.http_code == 520 and attempt < MAX_ATTEMPTS
sleep(rand(10))
Copy link
Contributor

Choose a reason for hiding this comment

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

Warum hier ein Zufall beim warten auf den nächsten Versuch? Ich kenne sonst das Pattern, dass mit jedem weiteren Versuch länger gewartet wird (als Optimierung der Gesamtwartezeit). Ich würde daher schreiben

Suggested change
sleep(rand(10))
sleep(attempt ** 2)

Das ** steht für Potenz.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Das Problem scheint daher zu kommen, dass bei einem Check-Request alle Docker-Nodes gleichzeitig zu quay.io rennen. Das würde sich nicht ändern, wenn alle Nodes deterministisch warten, um dann erneut gleichzeitig bei quay.io anzufragen. Ich will hier bewusst für eine zufällige zeitliche Streuung der Requests über die einzelnen Nodes sorgen.

@stefan-as stefan-as merged commit dbc25ce into master Jan 31, 2020
@jonathanschlue-as jonathanschlue-as deleted the feature/retry_on_520 branch May 23, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants