1
0
Fork 0
forked from OpenNeo/impress
impress/src/server
Matchu 299561d1e3 Paginate the user outfits page
My main inspiration for doing this is actually our potentially-huge upcoming Vercel bill lol

From inspecting my Honeycomb dashboard, it looks like the main offender for backend CPU time usage is outfit images. And it looks like they come in big spikes, of lots of low usage and then suddenly 1,000 requests in one minute.

My suspicion is that this is from users with many saved outfits loading their outfit page, which previously would show all of them at once.

We do have `loading="lazy"` set, but not all browsers support that yet, and I've had trouble pinning down the exact behavior anyway!

Anyway, paginating makes for a better experience for those huge-list users anyway. We've been meaning to do it, so here we go!

My hope is that this drastically decreases backend CPU hours immediately 🤞 If not, we'll need to investigate in more detail where these outfit image requests are actually coming from!

Note that I added the pagination to the existing `outfits` GraphQL endpoint, rather than creating a new one. I felt comfortable doing this because it requires login anyway, so I'm confident that other clients aren't using it; and because, while this kind of thing often creates a risk of problems with frontend and backend code getting out of sync, I think someone running old frontend code will just see only their first 30 outfits (but no pagination toolbar), and get confused and refresh the page, at which point they'll see all of them. (And I actually _prefer_ that slightly confusing UX, to avoid getting more giant spikes of outfit image requests, lol :p)
2021-11-01 19:33:40 -07:00
..
__image_snapshots__ outfit-images: render actual PNG and SVG layers! 2021-01-04 05:58:19 +00:00
__snapshots__ simplify validPetPoses out of the server directory 2020-09-06 00:40:00 -07:00
lib Apply sampling rates to Honeycomb events 2021-05-26 18:50:19 -07:00
types Paginate the user outfits page 2021-11-01 19:33:40 -07:00
auth.js Fix misc lint errors 2021-05-03 15:06:07 -07:00
db.js Use ES module syntax in backend instead of require 2021-02-02 22:26:55 -08:00
index.js Lint against console.log 2021-05-03 15:01:49 -07:00
loaders.js Paginate the user outfits page 2021-11-01 19:33:40 -07:00
modeling.js Lint against console.log 2021-05-03 15:01:49 -07:00
neopets-assets.js Support HTTPS asset URLs 2021-06-12 02:29:30 -07:00
outfit-images.js Fail harder when *all* layers fail to load 2021-09-03 14:55:50 -07:00
outfit-images.test.js Use Fastly to cache our PNG assets from S3 2021-05-12 22:49:59 -07:00
util.js Fix misc lint errors 2021-05-03 15:06:07 -07:00
util.test.js Fix misc lint errors 2021-05-03 15:06:07 -07:00