[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:
Vicente Rivera 2017-12-09 20:58:01 -03:00 committed by Will
parent 6d1d699059
commit ee0d1d269c

View File

@ -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()