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:
Jesse Rosenberger 2018-12-14 14:50:05 +02:00
parent 6b47f6f3e6
commit 89d20b39db
No known key found for this signature in database
GPG key ID: C0CCCF81AA6C08D8

View file

@ -135,15 +135,9 @@ export async function processGraphQLRequest<TContext>(
persistedQueryRegister = true;
// Store the query asynchronously so we don't block.
(async () => {
return (
config.persistedQueries &&
config.persistedQueries.cache.set(`apq:${queryHash}`, query)
);
})().catch(error => {
console.warn(error);
});
Promise.resolve(
config.persistedQueries.cache.set(`apq:${queryHash}`, query),
).catch(console.warn);
}
} else if (query) {
// FIXME: We'll compute the APQ query hash to use as our cache key for