apollographql / apollo-kotlin

:robot:  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
https://www.apollographql.com/docs/kotlin
MIT License
3.7k stars 651 forks source link

RetryOnNetworkErrorInterceptor should be configurable #5982

Closed edenman closed 1 week ago

edenman commented 2 weeks ago

Use case

We currently have our own interceptor to handle retries on network errors, but 1) it also retries if the http status code is 5xx 2) we'd like the ability to configure the backoff duration

Not a huge deal (we can obviously keep using our own) but I'd like to switch to using NetworkMonitor+failFastIfOffline+retryOnError if possible

Describe the solution you'd like

No response

martinbonnin commented 2 weeks ago

Agreed something needs to be done there. I've always tried to avoid giving "privileged" roles to interceptors so that they remain a generic list but the order matters (+ knowing whether a specific kind interceptor was set is also interesting information if we want a default behaviour). I'll look into this.

martinbonnin commented 1 week ago

ApolloClient.Builder.retryOnErrorInterceptor(ApolloInterceptor) is added in https://github.com/apollographql/apollo-kotlin/pull/5989

github-actions[bot] commented 1 week ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better.