Currently, I am working on a React Native game that involves users generating cards every 6 seconds. These cards are then sent to Google Firestore through my established Firebase connection.
The rate at which users generate cards is quite rapid: 1 card every 6 seconds equates to 10 per minute, or 600 per hour. Given Google Firebase's daily write limit of 20,000 for free, having just 34 users active on the service for an hour would surpass this threshold.
To address this issue, I have devised a temporary solution of storing the cards and associated data in the user's local storage using AsyncStorage before uploading them once they exceed a certain threshold. The code snippet responsible for this is outlined below:
// Access the user's inventory.
// Append the new card to their inventory.
// If the inventory size surpasses 15 items, batch write it to Firestore.
My question is - does this method effectively and securely manage the inflow of large amounts of swiftly incoming data?