Add debug lines to appearanceOn Apollo resolver

Hmm, the item page in prod is slower than it is in dev? In dev, most items are satisfied by the preloading in ItemPagePreview, but in prod, those same items need to send a separate OutfitItemsAppearance query _way_ after (which, I think just due to queueing, waits for all the items to wait too).

There's an obvious issue in the case of all the Maraquan items lately, because we just don't do the clever cache lookups for non-standard colors at all. But I don't understand why even standard items like the 17th Birthday Party Hat are struggling!

These are just some simple debug statements, hopefully they'll tell us something about the basics of what's happening!
This commit is contained in:
Emi Matchu 2021-07-21 16:03:24 -07:00
parent b7b4fa21ec
commit 2ba18ace4d

View file

@ -58,6 +58,12 @@ const typePolicies = {
// it! This helps for fast loading when switching between standard // it! This helps for fast loading when switching between standard
// colors. // colors.
const { speciesId, colorId } = args; const { speciesId, colorId } = args;
console.debug(
"[appearanceOn] seeking cached appearance",
speciesId,
colorId,
readField("id")
);
const speciesStandardBodyId = readField( const speciesStandardBodyId = readField(
"standardBodyId", "standardBodyId",
toReference({ __typename: "Species", id: speciesId }) toReference({ __typename: "Species", id: speciesId })
@ -71,16 +77,22 @@ const typePolicies = {
// be loading them, depending on the page? Either way, return // be loading them, depending on the page? Either way, return
// `undefined`, meaning we don't know how to serve this from cache. // `undefined`, meaning we don't know how to serve this from cache.
// This will cause us to start loading it from the server. // This will cause us to start loading it from the server.
console.debug("[appearanceOn] species/colors not loaded yet");
return undefined; return undefined;
} }
if (colorIsStandard) { if (colorIsStandard) {
const itemId = readField("id"); const itemId = readField("id");
console.debug(
"[appearanceOn] standard color, will read:",
`item-${itemId}-body-${speciesStandardBodyId}`
);
return toReference({ return toReference({
__typename: "ItemAppearance", __typename: "ItemAppearance",
id: `item-${itemId}-body-${speciesStandardBodyId}`, id: `item-${itemId}-body-${speciesStandardBodyId}`,
}); });
} else { } else {
console.debug("[appearanceOn] non-standard color, failure");
// This isn't a standard color, so we don't support special // This isn't a standard color, so we don't support special
// cross-color caching for it. Return `undefined`, meaning we don't // cross-color caching for it. Return `undefined`, meaning we don't
// know how to serve this from cache. This will cause us to start // know how to serve this from cache. This will cause us to start