jkomoros / card-web

The web app behind thecompendium.cards
Apache License 2.0
48 stars 8 forks source link

Move star_count calculations and other transaction calculations into a cloud function #70

Open jkomoros opened 5 years ago

jkomoros commented 5 years ago

So we limit the transactions on the server.

As a bonus, this makes #66 easier to do because we'll already have cloud functions set up

As documented here: https://firebase.google.com/docs/firestore/solutions/aggregation

jkomoros commented 5 years ago
jkomoros commented 5 years ago

The "up to 10 seconds to run the cloud function" kills the use case for updating star_count and thread_count since users expect those to update immediately as feedback the action was succesful.

jkomoros commented 4 years ago

I don't think it actually does kill the use case for the 10 second delay, because the button itself they hit will update immediately. It's the secondary indicatior on the card that will take some time t update.

But this would allow radically simplifying security rules on cards, and also allow having a read_count on the cards