mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[V3 Streams] Fix race issue on init (#1135)
* Fix for #1132 Fixes `self.streams` being a `Task` object instead of a list. Also replicated for `self.communities`, since the issue is the same (although untested, it can be inferred). * Implement sub-method to avoid init errors The new method waits for `streams` and `communities` to be initialized before running the `_stream_alerts` method, avoiding possible errors due to lists being uninitialized * Fix streams and communities loading * Delete IDE config file
This commit is contained in:
parent
6d1d699059
commit
ee0d1d269c
@ -41,8 +41,12 @@ class Streams:
|
||||
|
||||
self.bot = bot
|
||||
|
||||
self.streams = self.bot.loop.create_task(self.load_streams())
|
||||
self.communities = self.bot.loop.create_task(self.load_communities())
|
||||
self.bot.loop.create_task(self._initialize_lists())
|
||||
|
||||
async def _initialize_lists(self):
|
||||
self.streams = await self.load_streams()
|
||||
self.communities = await self.load_communities()
|
||||
|
||||
self.task = self.bot.loop.create_task(self._stream_alerts())
|
||||
|
||||
@commands.command()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user