Fixing Large Firestore Read Count

I’ve been working on a project that pulls users’ posts to be viewed. There are two “lists” of repeating cards, one showing the posts based on the number of likes, another based on how recent it was posted. These two lists are repeated via two App Variables that are “lists of objects”. These two variables are initialized in the Global Canvas by “When App Launched” and just two get record collection functions.

Originally I had a Data Variable that was being repeated in these lists but it was driving the read count per day in Firestore Database up in the thousands. I switched to the current Global Canvas > Repeating app variable set-up and Firestore Database is saying I’m clocking about 175k reads a day with this app.

I’m really trying to solve this and have tried everything I could find. A side-effect of this insane read count is simple buttons to replace the page take several seconds to load, instead of being pretty instant. I’m no expert but would love any advice, thank you!

What the app variables and repeating lists look like:

Add a throttle in front of the GET.

Also, make sure no other pages have the data variable added to them.

Thanks for the reply, definitely will try. I assume by throttle you mean just a delay? Or did you mean something else?

There is a marketplace function called throttle. You can set it to ensure it only runs once.

I´d also add in a load of diagnostic info and each page where you use that data source, increment a counter in the same logic flow and display it as a toast.

You might not have noticed, but adding a data source to a page also adds logic to get that data source and this runs often unless you modify it. To see the flow for it select the page, then variables, then data, then the specific data source, then expand the logic window, as per the image below.

1 Like

I did not know the throttle function exists, thanks again. And yea I’ve cleared out the extra data variables/their logic. Thanks again for the help