Hi, I keep hitting issues with Too many request to the database. I've tried a couple of the things seen in the forums. I'm attempting another update that I saw, however I'm getting this: ReferenceErrror: insert_inventory_counts is not defined (line 23). Here is a screenshot showing the javascript and query that is not being called for some reason.
You need to define insert_inventory_counts as a function, not as a block. The block can't be called from another block, the function can. Add it as a function in the side menu of your workflow. Then you can define the additionalScope scope param as well.
Thanks Mike, that worked. I actually had a function created, but have been trying a bunch of stuff to figure it out. Now my issue is:
So i'm definitely hitting this RetoolDB limit, it did end up doing 1000 of the 50k, so 1000 seems to be the number. I've tried changing the batch to 1000, 500, 200, 100, 50. It always ends up inserting 1000 then throwing the error.
I don't know RetoolDB's and don't see any mention in the docs - but maybe try doing a bulk insert instead of thousands of single inserts. Then you just need to chunk your items and pass each chunk to the function.
If it still exceeds the rate limit, just await each call and/or add a delay of some sort between calls, const delay = ms => await new Promise(resolve => setTimeout(resolve, ms))