Somehow I got in an infinite loop
I have this old code that worked well for a long time, but somehow it now gets stuck in an infinite loop:
In some commands I have a console log such as "find all / Search loaded." Those are printed constantly but the "gotten cmdsrelo on shard"... Is seemingly not printed.
7 Replies
Aha. Doing this as a work around prevents the infinite loop:
cmdsrelo.size
is 110 but the for loop runs forever if it's not brokenfirst of all
botclient.stores.get
doesnt return a Promise so you can remove that await
, it doesnt do anything.
Secondly, it returns a Map
so you should do
or better yet:
Lastly, if you use an external sharding manager (i.e. not DJS internal sharding) then you are responsible yourself for integrating that entirely within Sapphire as we do not add explicit support as there is simply no feasible way to support all sharding techniques.If what you want is to load all commands, your entire thing gets resolved by doing a single line of code:
loadAll
internally calls unloadAll
, so it'll unload all the pieces as efficiently as possible, then load all pieces at once, also as efficiently.
Reloading piece by piece in a loop has a large overhead since it doesn't batch the piece reloading, after all.Thanks well Ill change that then, this has been working well for a long time but I guess times up
Thank youu!
Also the reason this happened - ( because I updated sapphire?) is that I'm having a problem where broadcastEval blocks all the shards. Would it be okay to open a thread in #discordjs-support about that even thoguh I already made one in the discordJS server?
you wont really get better help here than in djs server tbh
oh ðŸ˜
But I think maybe it has just been slid down..