chore: use parallelForeach in deleteGuild
All checks were successful
Build / build (18) (push) Successful in 46s
Build / build (22) (push) Successful in 1m7s
Build / build (20) (push) Successful in 1m14s
Build / build (18) (pull_request) Successful in 49s
Build / build (20) (pull_request) Successful in 1m15s
Build / build (22) (pull_request) Successful in 1m14s
All checks were successful
Build / build (18) (push) Successful in 46s
Build / build (22) (push) Successful in 1m7s
Build / build (20) (push) Successful in 1m14s
Build / build (18) (pull_request) Successful in 49s
Build / build (20) (pull_request) Successful in 1m15s
Build / build (22) (pull_request) Successful in 1m14s
This commit is contained in:
parent
2746e243c9
commit
73e7bd60fd
@ -29,6 +29,7 @@ import { getRandomInt } from "./rngService";
|
||||
import { Inbox } from "../models/inboxModel";
|
||||
import { IFusionTreasure, ITypeCount } from "../types/inventoryTypes/inventoryTypes";
|
||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||
import { parallelForeach } from "../utils/async-utils";
|
||||
|
||||
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
@ -595,12 +596,12 @@ export const deleteGuild = async (guildId: Types.ObjectId): Promise<void> => {
|
||||
await Guild.deleteOne({ _id: guildId });
|
||||
|
||||
const guildMembers = await GuildMember.find({ guildId, status: 0 }, "accountId");
|
||||
for (const member of guildMembers) {
|
||||
await parallelForeach(guildMembers, async member => {
|
||||
const inventory = await getInventory(member.accountId.toString(), "GuildId LevelKeys Recipes");
|
||||
inventory.GuildId = undefined;
|
||||
removeDojoKeyItems(inventory);
|
||||
await inventory.save();
|
||||
}
|
||||
});
|
||||
|
||||
await GuildMember.deleteMany({ guildId });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user