-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apollo-datasource-rest caching everything #46
Comments
I guess this is why 408 timeout errors for GET requests are cached 🤔 |
I ran into this issue as well, and the cause turned out to be me not instantiating a new datasource for every request.
|
Hi there, I just posted a detailed description of the problem. Hope you find it useful until/if the issue gets fixed |
RESTDataSource contained a memoization cache (separate from the HTTP-header-sensitive shared cache) which caches all GET requests forever. This wasn't even documented for the first four years of RESTDataSource's existence and led to a lot of confusion. In this new major version, this cache will instead by default only de-duplicate *concurrent* GET requests. This also introduces `deduplicationPolicyFor()` which lets you tune how de-duplication works, including restoring v4 semantics (see the changeset for code snippets). Fixes #40. Fixes #72. Fixes #73. Fixes #46. Maybe fi-xes #39 but we could use a unit test. Somewhat addresses #65 but only for the de-duplication cache (we should still allow direct control over the cache key for the HTTP).
RESTDataSource contained a memoization cache (separate from the HTTP-header-sensitive shared cache) which caches all GET requests forever. This wasn't even documented for the first four years of RESTDataSource's existence and led to a lot of confusion. In this new major version, this cache will instead by default only de-duplicate *concurrent* GET requests. This also introduces `deduplicationPolicyFor()` which lets you tune how de-duplication works, including restoring v4 semantics (see the changeset for code snippets). Fixes #40. Fixes #72. Fixes #73. Fixes #46. Maybe fi-xes #39 but we could use a unit test. Somewhat addresses #65 but only for the de-duplication cache (we should still allow direct control over the cache key for the HTTP).
RESTDataSource contained a memoization cache (separate from the HTTP-header-sensitive shared cache) which caches all GET requests forever. This wasn't even documented for the first four years of RESTDataSource's existence and led to a lot of confusion. In this new major version, this cache will instead by default only de-duplicate *concurrent* GET requests. This also introduces `deduplicationPolicyFor()` which lets you tune how de-duplication works, including restoring v4 semantics (see the changeset for code snippets). Fixes #40. Fixes #72. Fixes #73. Fixes #46. Fixes #39 (though it "introduces" #102). Somewhat addresses #65 but only for the de-duplication cache (we should still allow direct control over the cache key for the HTTP).
RESTDataSource contained a memoization cache (separate from the HTTP-header-sensitive shared cache) which caches all GET requests forever. This wasn't even documented for the first four years of RESTDataSource's existence and led to a lot of confusion. In this new major version, this cache will instead by default only de-duplicate *concurrent* GET requests. This also introduces `deduplicationPolicyFor()` which lets you tune how de-duplication works, including restoring v4 semantics (see the changeset for code snippets). Fixes #40. Fixes #72. Fixes #73. Fixes #46. Fixes #39 (though it "introduces" #102). Somewhat addresses #65 but only for the de-duplication cache (we should still allow direct control over the cache key for the HTTP).
apollo-datasource-rest
has aHTTPCache
that probably works fine, but it is never invoked becauseRESTDataSource
caches the promise itself, the first time it is called (for GET requests).This seems to defeat the purpose of having
HTTPCache
altogether, but looking at the Git history, a good deal of work was put into this memoization, so maybe there is a reason for it?https://github.com/apollographql/apollo-server/blob/f25784d51130bbb9014b727e2f231e5a737f4a50/packages/apollo-datasource-rest/src/RESTDataSource.ts#L270
The text was updated successfully, but these errors were encountered: