🎈 perf(dispatch): 路由使用redis
This commit is contained in:
@@ -4,8 +4,9 @@ import { pinus } from "pinus";
|
||||
import { GVG_CATAPULT, GVG_PERIOD } from "../../consts";
|
||||
import { GVGTeamModel, GVGTeamType } from "../../db/GVGTeam";
|
||||
import { GVGTeamMem } from "../../domain/battleField/gvgBattle";
|
||||
import { dispatch } from "../../util/dispatcher";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { getGVGPeriodData } from "./gvgService";
|
||||
import { redisClient } from "../redisService";
|
||||
|
||||
// 积分点占领情况,groupId_serverType_cityId -> GVGBattleData
|
||||
const gvgBattleMap: Map<string, GVGBattleData> = new Map();
|
||||
@@ -244,7 +245,7 @@ export async function initTeamToMem() {
|
||||
let teams = await GVGTeamModel.findByConfigId(configId);
|
||||
for(let team of teams) {
|
||||
if(team.isBroken) continue;
|
||||
if(dispatch(team.cityId.toString(), servers)?.id == sid) {
|
||||
if((await dispatch(redisClient(), team.cityId.toString(), servers, 'guild'))?.id == sid) {
|
||||
let teamObj = getGVGBattleData(team.groupKey);
|
||||
teamObj.enterCity(team);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { GVGHeroInfo, PvpEnemies, PvpHeroInfo } from "../../domain/dbGeneral";
|
||||
import { getGroupKey, getGVGConfig, getGVGConfigFromRemote, getGVGPeriodData } from "./gvgService";
|
||||
import { GVGLeaguePrepareModel } from "../../db/GVGLeaguePrepare";
|
||||
import { pinus } from "pinus";
|
||||
import { dispatch } from "../../util/dispatcher";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { Rank } from "../rankService";
|
||||
import { KeyNameParam, LeagueRankInfo, myIdInter, RoleRankInfo } from "../../domain/rank";
|
||||
import { findKeys, getAllServerName, redisClient } from "../redisService";
|
||||
@@ -358,7 +358,7 @@ export async function gvgBattleStart() {
|
||||
let { configId } = getGVGConfig();
|
||||
let guardCities = await GVGCityModel.findAllGuardCities(configId);
|
||||
for(let { cityId, groupKey, guardLeague, guardLeagueName } of guardCities) {
|
||||
let sid = dispatch(cityId.toString(), servers)?.id;
|
||||
let sid = (await dispatch(redisClient(), cityId.toString(), servers, 'guild'))?.id;
|
||||
await pinus.app.rpc.guild.guildRemote.initCatapult.toServer(sid, cityId, groupKey, guardLeague, guardLeagueName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user