mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 02:01:40 -05:00
chore: Simplify logic for caching persisted query asynchronously.
This method is so large this was just low-hanging fruit along a path of potential opportunities.
This commit is contained in:
parent
6b47f6f3e6
commit
89d20b39db
1 changed files with 3 additions and 9 deletions
|
@ -135,15 +135,9 @@ export async function processGraphQLRequest<TContext>(
|
||||||
|
|
||||||
persistedQueryRegister = true;
|
persistedQueryRegister = true;
|
||||||
|
|
||||||
// Store the query asynchronously so we don't block.
|
Promise.resolve(
|
||||||
(async () => {
|
config.persistedQueries.cache.set(`apq:${queryHash}`, query),
|
||||||
return (
|
).catch(console.warn);
|
||||||
config.persistedQueries &&
|
|
||||||
config.persistedQueries.cache.set(`apq:${queryHash}`, query)
|
|
||||||
);
|
|
||||||
})().catch(error => {
|
|
||||||
console.warn(error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (query) {
|
} else if (query) {
|
||||||
// FIXME: We'll compute the APQ query hash to use as our cache key for
|
// FIXME: We'll compute the APQ query hash to use as our cache key for
|
||||||
|
|
Loading…
Add table
Reference in a new issue