Library / Application design question - who handles retries

I’m working with an application (https://github.com/obahareth/has-my-gsuite-been-pwned) that uses a library ( techgaun/ ex_pwned) to check if a user account has been compromised.

Part of the “have i been pwned” api is a rate limitation. If a rate limit is in effect a “Retry-After” field will be sent back in the response header. Currently when this is returned the library errors out.

I’m not fully versed in the “let it crash” philosophy so i’m struggling with where the logic needs to sit to handle waiting and retrying the request. Pros to having it at the application level is the library will be more transparent to what is actually happening. Pros to having it at the library level is a more simplified application.

Recommendations?

Maybe GenRety can help You?

1 Like

For a library return a timeout error possible with retry details. The application should normally determine the retry policy.

2 Likes

For note, the "Let it Fail’ bit is referencing things that shouldn’t happen, instead of being defensive against those just let them fail and get a stacktrace. For things that are expected that they can fail, like a remote server you are talking with, that should instead be handled, either by letting it fail if it is only a one-off that you aren’t restarting, or via something else.

3 Likes