proposal: [apollo-datasource-rest] - bypass redis cache while redis host is not reachable
See original GitHub issueIf Redis host is down, i.e. not reachable, the query response gets this error:
"message": "Reached the max retries per request limit (which is 3). Refer to \"maxRetriesPerRequest\" option for details."
However, I think that showing this kind of error should be avoided and the default response’s flow should be granted.
In https://github.com/apollographql/apollo-server/blob/master/packages/apollo-datasource-rest/src/HTTPCache.ts
line 38 will assign the ioredis’ error to entry
.
...
const entry = await this.keyValueCache.get(cacheKey);
if (!entry) {
const response = await this.httpFetch(request);
...
I guess entry should be null in that case so that const response = await this.httpFetch(request);
can be executed if redis’ host is down.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:10 (2 by maintainers)
Top Results From Across the Web
How to disable Redis Caching at run time if redis connection ...
If the Redis connection is stale/closed or otherwise, then you want the application to bypass caching and (presumably) go directly to an underlying...
Read more >Data sources - Apollo Server - Apollo GraphQL Docs
Data sources are classes that encapsulate fetching data from a particular service, with built-in support for caching, deduplication, and error handling.
Read more >Spring Boot Redis Cache - DigitalOcean
In this post, we will setup up a sample Spring boot application and integrate it with Redis Cache. While Redis is an Open...
Read more >Amazon ElastiCache for Redis
Amazon ElastiCache for Redis is a Redis-compatible in-memory data store service that can be used as a database, cache, message broker, and queue...
Read more >Spring Data Redis
The Spring Framework is the leading full-stack Java/JEE application framework. It provides a lightweight container and a non-invasive ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@geraldstrobl Nope, no PR.
This issue is been waiting for a response from the team. Still nothing.
I guess it is not a high priority.
In case you want to save yourself all of this overhead, here a shameless plug: I built https://graphcdn.io, which takes care of the caching for you. I promise you, that you won’t hit these limitations there. You won’t need to host any Redis with that anymore.