From e97f638a95f87fe0c12e026c9764205f199bc51f Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Tue, 10 Dec 2024 11:27:20 +0100 Subject: [PATCH] HTTP cache: do not remove cached entries on transport errors See https://github.com/apollographql/apollo-kotlin/issues/6313 --- .../apollo/cache/http/internal/HttpCacheApolloInterceptor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-http-cache/src/main/kotlin/com/apollographql/apollo/cache/http/internal/HttpCacheApolloInterceptor.kt b/libraries/apollo-http-cache/src/main/kotlin/com/apollographql/apollo/cache/http/internal/HttpCacheApolloInterceptor.kt index 7bd63763ab0..a0b91e5932c 100644 --- a/libraries/apollo-http-cache/src/main/kotlin/com/apollographql/apollo/cache/http/internal/HttpCacheApolloInterceptor.kt +++ b/libraries/apollo-http-cache/src/main/kotlin/com/apollographql/apollo/cache/http/internal/HttpCacheApolloInterceptor.kt @@ -50,7 +50,7 @@ internal class HttpCacheApolloInterceptor( onEach { response -> // Revert caching of responses with errors val cacheKey = synchronized(apolloRequestToCacheKey) { apolloRequestToCacheKey[request.requestUuid.toString()] } - if (response.hasErrors() || response.exception != null) { + if (response.hasErrors()) { try { cacheKey?.let { cachingHttpInterceptor.cache.remove(it) } } catch (_: IOException) {