rauno56 / climbing-card-check

climbing-card-check.vercel.app
0 stars 2 forks source link

Fetching the whole spreadsheet for each sheet? #25

Open taavilooke opened 8 months ago

taavilooke commented 8 months ago

I noticed that right now the code fetches the whole database each time a card is checked. It works fine right now, there's a slight delay, but as more cards get added, this might become a problem.

https://github.com/rauno56/climbing-card-check/blob/50f2d2004dba00f3589d60879ec623e39b924227/api/_db.js#L52

rauno56 commented 5 months ago

There's no API for in-flight-filtering for Sheets.

Most of the current delay is due to multiple round-trips for authentication and the API. The size of the data plays a relatively small role for any foreseeable future.

taavilooke commented 5 months ago

The csv representation of the whole database is about 71kB now at 470 entries.

rauno56 commented 5 months ago

It's important to note, that this 71kB will never be shipped to client but are exchanged between AWS and GCP.

We do perhaps need to optimize it at some point and have some sort of a cache in between.