use parallelForeach to send ascension inbox message
This commit is contained in:
parent
3165d9f459
commit
4e077e7602
@ -5,6 +5,7 @@ import { config } from "@/src/services/configService";
|
|||||||
import { createMessage } from "@/src/services/inboxService";
|
import { createMessage } from "@/src/services/inboxService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { parallelForeach } from "@/src/utils/async-utils";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ export const contributeGuildClassController: RequestHandler = async (req, res) =
|
|||||||
if (!config.fastClanAscension) {
|
if (!config.fastClanAscension) {
|
||||||
// Send message to all active guild members
|
// Send message to all active guild members
|
||||||
const members = await GuildMember.find({ guildId: payload.GuildId, status: 0 }, "accountId");
|
const members = await GuildMember.find({ guildId: payload.GuildId, status: 0 }, "accountId");
|
||||||
for (const member of members) {
|
await parallelForeach(members, async member => {
|
||||||
// somewhat unfaithful as on live the "msg" is not a loctag, but since we don't have the string, we'll let the client fill it in with "arg".
|
// somewhat unfaithful as on live the "msg" is not a loctag, but since we don't have the string, we'll let the client fill it in with "arg".
|
||||||
await createMessage(member.accountId, [
|
await createMessage(member.accountId, [
|
||||||
{
|
{
|
||||||
@ -49,15 +50,15 @@ export const contributeGuildClassController: RequestHandler = async (req, res) =
|
|||||||
{
|
{
|
||||||
Key: "RESETDATE",
|
Key: "RESETDATE",
|
||||||
Tag:
|
Tag:
|
||||||
guild.CeremonyResetDate.getUTCMonth() +
|
guild.CeremonyResetDate!.getUTCMonth() +
|
||||||
"/" +
|
"/" +
|
||||||
guild.CeremonyResetDate.getUTCDate() +
|
guild.CeremonyResetDate!.getUTCDate() +
|
||||||
"/" +
|
"/" +
|
||||||
(guild.CeremonyResetDate.getUTCFullYear() % 100) +
|
(guild.CeremonyResetDate!.getUTCFullYear() % 100) +
|
||||||
" " +
|
" " +
|
||||||
guild.CeremonyResetDate.getUTCHours().toString().padStart(2, "0") +
|
guild.CeremonyResetDate!.getUTCHours().toString().padStart(2, "0") +
|
||||||
":" +
|
":" +
|
||||||
guild.CeremonyResetDate.getUTCMinutes().toString().padStart(2, "0")
|
guild.CeremonyResetDate!.getUTCMinutes().toString().padStart(2, "0")
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
sub: "/Lotus/Language/Clan/Clan_AscensionCeremonyInProgress",
|
sub: "/Lotus/Language/Clan/Clan_AscensionCeremonyInProgress",
|
||||||
@ -65,7 +66,7 @@ export const contributeGuildClassController: RequestHandler = async (req, res) =
|
|||||||
highPriority: true
|
highPriority: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user