Script execution timeout

I’m just wondering why the script execution timeout is set to 25ms it’s seems slightly low to but idk. Anyways I’m wondering because it seems like it’ll become an issue for me in the future with the Pokémon command I made. Since it has to search through an array for Pokémon names. And from my testing I’m only able to do 8900 searches before the script is timed out. And the array gets one longer every time the command is used. Anyways just wondering get back to me whenever :man_shrugging:

Hey @potatoeaterlove!

I’m not sure, but I think @night updated Nightbot to limit the script execution time recently because of the server issues the bot encounters.

I too had a command that was working before and it started timing out. I had to write the code all over again but that was for the better. The problem was, because I wrote the code when I didn’t know much about JS, major flaws that were slowing down the execution of the code: a lot of inefficient for loops.

1 Like

Thank you for the response it’s mainly and issue when they want to look at their Pokémon it has to search through every entry. I just set it up so it only has to search through each users entry’s and not every single one. And it only adds entry’s that actually update the info. But this only prolongs the issue eventually if a person uses the command enough they will get timed out. I just don’t know what I can do to prevent that inevitability. But, anyways thanks for the response.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

25ms is fairly reasonable and ensures 1 user is not causing extraneous synchronous load on the shared resource. If you’re spending 25ms searching, you may need to find a better data structure or search algorithm.