`maxTtlIfError` behavior clarification.
Opened this issue ยท 5 comments
This line makes it appear maxTtlIfError
is whatever value is provided in seconds for maxTtlIfError
apollo-datasource-http/README.md
Line 113 in 5f0036f
This line makes it appear as though maxTtlIfError
actually ends up being maxTtl + maxTtlIfError
.
I'm happy to PR clarification once I have it. Just need to know what that is ๐ .
Hi @JustinTRoss, you're right this is confusing. The TTL of the error cache must always be longer than the default TTL cache.
maxTtlIfError
defines the exact duration in seconds of the error cache. We should update docs with this, for example:
maxTtl: 60 // cache requests for 1min
maxTtlIfError: 60 // cache for another 1min when the revalidation requests result in an error.
Got it. To confirm:
requestCache: {
maxTtl: 10 * 60, // 10min, will respond for 10min with the result in cache (revalidated every 10min)
maxTtlIfError: 30 * 60, // 30min, will respond with the result in cache for a further 30 minutes when revalidation attempts result in error (40 minutes total)
},
yes, (40 minutes total)
is confusing. I'd remove it.
Agreed. It could be better worded. It sounds like the sentiment is generally true though, that the cached value can be returned for up to 40 minutes. This seems necessary for folks to understand. I'll work on conveying it clearly and send a PR with updated docs.
Thanks again! ๐
Thanks!