diff --git a/litecord/voice/lvsp_manager.py b/litecord/voice/lvsp_manager.py index 9a2eb41..e96e1b0 100644 --- a/litecord/voice/lvsp_manager.py +++ b/litecord/voice/lvsp_manager.py @@ -56,7 +56,7 @@ class LVSPManager: # quick storage for Region dataclass instances. self._regions = {} - self.app.loop.create_task(self._spawn()) + self.app.sched.spawn(self._spawn()) async def _spawn(self): """Spawn LVSPConnection for each region.""" diff --git a/manage/main.py b/manage/main.py index 805b28c..9968eef 100644 --- a/manage/main.py +++ b/manage/main.py @@ -40,8 +40,12 @@ class FakeApp: ratelimiter = None state_manager = None storage = None + user_storage = None + icons = None dispatcher = None presence = None + voice = None + guild_store = None def init_parser(): @@ -76,7 +80,7 @@ def main(config): # as the managers require it # and the migrate command also sets the db up if argv[1] != 'migrate': - init_app_managers(app) + init_app_managers(app, voice=False) args = parser.parse_args() loop.run_until_complete(args.func(app, args)) diff --git a/run.py b/run.py index d851fdc..dbf1965 100644 --- a/run.py +++ b/run.py @@ -230,7 +230,7 @@ async def init_app_db(app_): app_.sched = JobManager() -def init_app_managers(app_): +def init_app_managers(app_, *, voice=True): """Initialize singleton classes.""" app_.loop = asyncio.get_event_loop() app_.ratelimiter = RatelimitManager(app_.config.get('_testing')) @@ -246,7 +246,13 @@ def init_app_managers(app_): app_.storage.presence = app_.presence - app_.voice = VoiceManager(app_) + # only start VoiceManager if needed. + # we do this because of a bug on ./manage.py where it + # cancels the LVSPManager's spawn regions task. we don't + # need to start it on manage time. + if voice: + app_.voice = VoiceManager(app_) + app_.guild_store = GuildMemoryStore()