Skip to content

Commit a8e3512

Browse files
committed
CHANGES:
- Warehouse data is uploaded in parallel now.
1 parent 23245e3 commit a8e3512

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

plugins/mission/commands.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,19 +2490,21 @@ async def upload_warehouse_data(channel: discord.TextChannel, server: Server, sh
24902490
for airport in airports:
24912491
await channel.send(_("Loading warehouse for airport {} ...").format(airport))
24922492
for key, values in sheets.items():
2493-
await channel.send(_("Uploading {} information to your warehouse ...").format(SHEET_TITLES[key]))
2493+
await channel.send(_("> uploading {} information ...").format(SHEET_TITLES[key].lower()))
2494+
tasks = []
24942495
for k, v in values.items():
24952496
if key != 'liquids':
24962497
cmd = "setWarehouseItem"
24972498
else:
24982499
cmd = "setWarehouseLiquid"
2499-
await server.send_to_dcs_sync({
2500+
tasks.append(server.send_to_dcs_sync({
25002501
"command": cmd,
25012502
"name": airport,
25022503
"item": k,
25032504
"value": v
2504-
}, timeout=60)
2505-
await channel.send(_("Warehouse updated."))
2505+
}, timeout=60))
2506+
await asyncio.gather(*tasks)
2507+
await channel.send(_("Warehouse at {} updated.").format(airport))
25062508

25072509
async def handle_warehouse_uploads(self, message: discord.Message):
25082510
if not utils.check_roles(set(self.bot.roles['DCS Admin'] + self.bot.roles['GameMaster']), message.author):
@@ -2559,7 +2561,7 @@ async def handle_warehouse_uploads(self, message: discord.Message):
25592561
if not await utils.yn_question(
25602562
ctx,
25612563
question=_("Do you want to load a new warehouse configuration?"),
2562-
message=_("This will replace the warehouse configuration for {}").format(','.join(airports))
2564+
message=_("This will replace the warehouse configuration for:\n{}").format(','.join(airports))
25632565
):
25642566
await message.channel.send(_("Aborted."))
25652567
return

0 commit comments

Comments
 (0)