chore: save inventory and account in parallel when claiming login reward
All checks were successful
Build / build (pull_request) Successful in 50s
All checks were successful
Build / build (pull_request) Successful in 50s
This commit is contained in:
parent
24d9dc27e2
commit
5a6ad9f00a
@ -48,10 +48,8 @@ export const loginRewardsController: RequestHandler = async (req, res) => {
|
||||
response.DailyTributeInfo.HasChosenReward = true;
|
||||
response.DailyTributeInfo.ChosenReward = randomRewards[0];
|
||||
response.DailyTributeInfo.NewInventory = await claimLoginReward(inventory, randomRewards[0]);
|
||||
await inventory.save();
|
||||
|
||||
setAccountGotLoginRewardToday(account);
|
||||
await account.save();
|
||||
await Promise.all([inventory.save(), account.save()]);
|
||||
|
||||
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
|
||||
}
|
||||
|
@ -35,10 +35,8 @@ export const loginRewardsSelectionController: RequestHandler = async (req, res)
|
||||
chosenReward = randomRewards.find(x => x.StoreItemType == body.ChosenReward)!;
|
||||
inventoryChanges = await claimLoginReward(inventory, chosenReward);
|
||||
}
|
||||
await inventory.save();
|
||||
|
||||
setAccountGotLoginRewardToday(account);
|
||||
await account.save();
|
||||
await Promise.all([inventory.save(), account.save()]);
|
||||
|
||||
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
|
||||
res.json({
|
||||
|
Loading…
x
Reference in New Issue
Block a user