BackgroundService Question
Hello :D
I'd like to get some feedback on the
Microsoft.Extensions.Hosting
's BackgroundService . The issue i'm facing seems to be a race issue between the Discord client initializing and another hosted service being started and inheriting said client before it is properly initialized. The confusing part is that a second hosted service (the main class handling pretty much the registering of commands, modules, and logging) also inherits the DiscordSocketClient but this service is actually receiving the full initialized instance despite being registered right under InteractionManager. I would love some help on this :(
Code: https://paste.mod.gg/acslcflspkxc/0
Thank you!! :3BlazeBin - acslcflspkxc
A tool for sharing your source code with the world!
4 Replies
Probably shouldn't reference a hsoted service from another.
Ah er- are they referencing from another?
hm.
being started and inheriting said client
guess i dunno what you mean by that
well, i can probs close this actually.
the issue was that
Discord.Addons.Hosting
contains a WaitForReadyAsync
method that is specifically designed for cases like this which is... eh. i missed that in the documentation somehow but yep.