I’m looking to set 6 values in a row of a database table to a random value from a list. The list of options is not always the same, so I’m storing the lists in a json array within a database at the moment. The database just has the Row ID, owner, and option columns. The options column contains my json. I’m finding that I have to generate a random number, and then parse json, and iterate over that 6 times to get these values which is slowing my slash command down to a snail pace. Is there any way to do this in a more simple way? Like some sort of expression or other block?
Appreciate any help, thanks.
Your description of the flow isn’t enough information to determine if the performance issue is something you’re doing, or a problem with Inventor. If you could provide a screenshot of the blocks in the flow and their order, that would be extremely helpful. We’ve been working through some performance issues the past few weeks, so its possible that your use-case is fine and there’s a performance issue on Inventor’s end causing problems.
It’s really important to keep in mind that anything inside a loop will run multiple times, so performance-intensive blocks (db lookups, network requests, etc.) shouldn’t be in loops if that loop blocks a response to a user or there is another reason that the performance of that loop is important. You should also keep in mind that, even if you aren’t using a block, every enabled block in your flow will run as it is placed. Disable or delete any unused blocks to keep them from impacting your performance.
You should also use the trace tool to figure out which specific block is slowing things down. To turn that on, click the 3 dots next to the flow name in the flow editor, then click “Enable Traces”, then run the command (or whatever trigger) to execute the flow. After that, look on the analytics tab of the dashboard. You’ll be able to click the event/trace ID to view the trace. It will show a breakdown of every block that ran, and how long it took (as well as the inputs/outputs).
Once you have that trace, please send a screenshot of the breakdown graph (it’ll be a vertical bar graph on the left side at the bottom). Highlight any ‘large’ blocks in that graph so we can see the name of the block and its runtime - this may require multiple screenshots.
Thank you, I went back and restructured to limit database calls, and took them out of the loop completely. Its still having major performance issues, and the command in Discord just hangs and says the bot is thinking. I turned on trace but how can i see those results when its hanging like that and never resolving? Here are my flow screenshots either way:
This indicates that you’re exceeding your plan’s flow execution time limit. You can check errors to see if this is the case.
If possible, please still send over a trace of the flow since that will help reveal any blocks running for an extended period of time.
Assuming you are looping for a relatively small number of times and you are exceeding the time limit, this definitely looks closer to an Inventor issue than something wrong with your flow. Sending over a flow trace will allow us to address/resolve the issue since it gives us a better idea of the affected block(s).