remove app param from guild_region_check()

This commit is contained in:
Luna 2019-10-25 10:52:46 -03:00
parent e0a849fa6a
commit ce04ac5c5f
2 changed files with 13 additions and 13 deletions

View File

@ -118,7 +118,7 @@ async def deprecate_region(region):
return "", 204 return "", 204
async def guild_region_check(app_): async def guild_region_check():
"""Check all guilds for voice region inconsistencies. """Check all guilds for voice region inconsistencies.
Since the voice migration caused all guilds.region columns Since the voice migration caused all guilds.region columns
@ -126,23 +126,23 @@ async def guild_region_check(app_):
than one region setup. than one region setup.
""" """
regions = await app_.storage.all_voice_regions() regions = await app.storage.all_voice_regions()
if not regions: if not regions:
log.info("region check: no regions to move guilds to") log.info("region check: no regions to move guilds to")
return return
res = await app_.db.execute( res = await app.db.execute(
""" """
UPDATE guilds UPDATE guilds
SET region = ( SET region = (
SELECT id SELECT id
FROM voice_regions FROM voice_regions
OFFSET floor(random()*$1) OFFSET floor(random()*$1)
LIMIT 1 LIMIT 1
) )
WHERE region = NULL WHERE region = NULL
""", """,
len(regions), len(regions),
) )

2
run.py
View File

@ -339,7 +339,7 @@ async def post_app_start(app_):
# we'll need to start a billing job # we'll need to start a billing job
app_.sched.spawn(payment_job(app_)) app_.sched.spawn(payment_job(app_))
app_.sched.spawn(api_index(app_)) app_.sched.spawn(api_index(app_))
app_.sched.spawn(guild_region_check(app_)) app_.sched.spawn(guild_region_check())
def start_websocket(host, port, ws_handler) -> asyncio.Future: def start_websocket(host, port, ws_handler) -> asyncio.Future: