https://discord.gg/botpress logo
Why does "saving states" take so long ?
# 🤝help
w
Very simple workflow, just trying to execute my code card, so i don't have any huge context that would be saved it's a simple api call that is completed in a few second , but there the card takes 40 seconds to be executed If anyone has insights on this i'd like to hear them ! https://cdn.discordapp.com/attachments/1427955747723022367/1427955747999842354/image.png?ex=68f0beec&is=68ef6d6c&hm=c89992b721d578763025ebfdf8684ae018d7fac4adb3569059c817c07da8c67f& https://cdn.discordapp.com/attachments/1427955747723022367/1427955748448768071/image.png?ex=68f0beec&is=68ef6d6c&hm=6dcea4a6141355f0c95b11fdba92b023918afd4f8bc63019a43a710a89712326&
w
can you send the code please?
w
Basically it's a file search using the Botpress client
client.searchFiles({search, limit:10}) and that's it
w
huh
does it also take that long on prod?
emulator normally does things a bit differently
do you have a large number of files being searched through/are they really big?
also are they indexed
w
Hi Shen, the problem is not in the settings or data. 000Bo mentioned that the issue lies in saving the state (an internal Botpress process). He is a great BotBassador, I’ve learned a lot from him.😉
w
oh whoops sorry! i'm pretty new to the files api so i don't know much yet
w
Don't worry, Shen. You are a great help, and I like your posts. The saving state is a Botpress process that maintains the state of the bot, conversation, and variables. If you look at the log in the emulator or dashboard, you'll see some rows indicating the saved state.
w
Thank you Zannax and Shen ! 🙂
I do recognize it might have a link with calling the api , since the issue is particularly visible with this example
But my question then would be, why isn't it saving states after the result is returned
It would make more sense
w
thinking about this after taking a look at some logs, and maybe the logs are misleading.. what if what's taking long is actually the search, and the logs are just mistimed?
i say this because when comparing autonomous nodes' duration of each step and iteration, they don't really match up with the logs
because the huge 40 second delay occurs on the "SAVED states", not something like "saving states"..
so it moves the suspicion onto either the search itself or some other mysterious reason
w
Yes I have thought about that , but sometimes it takes literally 3/4 seconds to execute the search, and sometimes 40 seconds , and those times correspond to the ones where the logs indicate "saved states"