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; 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