Mitsunee / fgo-timers

Fansite for the global version of Fate/Grand Order with Event Timers, info on future Upgrades, Interludes, Rank Ups, Login Exchange Tickets and Calculators
https://fgo.mitsunee.com
7 stars 1 forks source link

feat: Improve Atlas API caching #102

Closed Mitsunee closed 1 year ago

Mitsunee commented 1 year ago

CI Cache key (rejected idea)

Tried implementing this and the actions runner does not wait for the node script to finish before getting the cache key, so this approach does not work. Instead of using date add a script to pull https://api.atlasacademy.io/info and create a cache key like ```js console.log(`ATLAS-API-KEY=${info.JP.hash}-${info.NA.hash}`); ``` ```yml - name: Get AtlasAcademy API Cache Key run: node src/ci/atlas-key.mjs >> $GITHUB_ENV ``` This would require setting up node first so the runtime and api-connector are available, but would significantly improve cache validity.

Testing prepare script

A new script in src/ci that simply prepares the atlas cache so jest can run without running the full prebuild script

Atlas Cache improvements

Currently it seems like slamming the API with multiple requests at ones causes it to stall. A for loop would possibly be faster. Or it's axios in the connector being slow...