Commit 195a219f authored by Luna's avatar Luna 😻

add ability to purposefully disable voice initialization

there is an issue (not very urgent) where a traceback was shown at any
`manage.py` usage. this was not catched before because of recent
modifications that removed manager startup when calling `migrate`.
parent 5dbf8ac8
Pipeline #57861892 passed with stages
in 8 minutes and 43 seconds
......@@ -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."""
......
......@@ -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))
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment