QuiltMC / quiltmc.org

The source for quiltmc.org
https://quiltmc.org
Other
58 stars 48 forks source link

Optimize team listings by caching PluralKit requests #72

Closed pluiedev closed 1 year ago

pluiedev commented 1 year ago

By letting a build script query the PluralKit API and cache the results from that query, we don't have to query the PK API on every rebuild, which ends up massively speeding up the build process.

From this: Unoptimized version - the site is built in 10.08s

To this: Optimized version - the site is built in 3.17s

The benefit should be obvious enough.

netlify[bot] commented 1 year ago

Deploy Preview for ecstatic-booth-88897a ready!

Name Link
Latest commit e756474d94bc3efeccae2ee9cf53fa0207792d23
Latest deploy log https://app.netlify.com/sites/ecstatic-booth-88897a/deploys/633443607bdb4800084e638d
Deploy Preview https://deploy-preview-72--ecstatic-booth-88897a.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

pluiedev commented 1 year ago

Ugh, looks like Netlify is trying to use Node 16.x again...

Southpaw1496 commented 1 year ago

Sometimes we intentionally rebuild the site to refresh PluralKit, does this account for that? If not, how often does the script refresh its data?

pluiedev commented 1 year ago

Sometimes we intentionally rebuild the site to refresh PluralKit, does this account for that? If not, how often does the script refresh its data?

You can run pnpm run clean to purge the PK cache, and it refreshes the data once every 10 minutes by default.

Southpaw1496 commented 1 year ago

We're really building stuff more than once every 10 minutes?

Southpaw1496 commented 1 year ago

Why did you have to put that commit in this PR 😔

pluiedev commented 1 year ago

We're really building stuff more than once every 10 minutes?

Yup - it doesn't just impact final builds, it also impacts dev builds. Although, I think it's reasonable to make it longer

pluiedev commented 1 year ago

Why did you have to put that commit in this PR pensive

Weeeeellll ADCLeo asked for it :>

Southpaw1496 commented 1 year ago

You could've sent it to the master branch