mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 07:21:48 +00:00
[Databuckets] Improvements to distributed cache, reload commands (#3519)
* [Databuckets] Improvements to distributed cache, reload commands * Add to reload_types
This commit is contained in:
parent
063d4fbd1a
commit
55161e18c8
@ -249,6 +249,7 @@
|
|||||||
#define ServerOP_ReloadZonePoints 0x4122
|
#define ServerOP_ReloadZonePoints 0x4122
|
||||||
#define ServerOP_ReloadDzTemplates 0x4123
|
#define ServerOP_ReloadDzTemplates 0x4123
|
||||||
#define ServerOP_ReloadZoneData 0x4124
|
#define ServerOP_ReloadZoneData 0x4124
|
||||||
|
#define ServerOP_ReloadDataBucketsCache 0x4125
|
||||||
|
|
||||||
#define ServerOP_CZDialogueWindow 0x4500
|
#define ServerOP_CZDialogueWindow 0x4500
|
||||||
#define ServerOP_CZLDoNUpdate 0x4501
|
#define ServerOP_CZLDoNUpdate 0x4501
|
||||||
|
|||||||
@ -138,6 +138,7 @@ std::vector<Reload> reload_types = {
|
|||||||
Reload{.command = "alternate_currencies", .opcode = ServerOP_ReloadAlternateCurrencies, .desc = "Alternate Currencies"},
|
Reload{.command = "alternate_currencies", .opcode = ServerOP_ReloadAlternateCurrencies, .desc = "Alternate Currencies"},
|
||||||
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
|
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
|
||||||
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
|
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
|
||||||
|
Reload{.command = "data_buckets_cache", .opcode = ServerOP_ReloadDataBucketsCache, .desc = "Data Buckets Cache"},
|
||||||
Reload{.command = "doors", .opcode = ServerOP_ReloadDoors, .desc = "Doors"},
|
Reload{.command = "doors", .opcode = ServerOP_ReloadDoors, .desc = "Doors"},
|
||||||
Reload{.command = "dztemplates", .opcode = ServerOP_ReloadDzTemplates, .desc = "Dynamic Zone Templates"},
|
Reload{.command = "dztemplates", .opcode = ServerOP_ReloadDzTemplates, .desc = "Dynamic Zone Templates"},
|
||||||
Reload{.command = "ground_spawns", .opcode = ServerOP_ReloadGroundSpawns, .desc = "Ground Spawns"},
|
Reload{.command = "ground_spawns", .opcode = ServerOP_ReloadGroundSpawns, .desc = "Ground Spawns"},
|
||||||
|
|||||||
@ -1343,6 +1343,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_ReloadBlockedSpells:
|
case ServerOP_ReloadBlockedSpells:
|
||||||
case ServerOP_ReloadCommands:
|
case ServerOP_ReloadCommands:
|
||||||
case ServerOP_ReloadDoors:
|
case ServerOP_ReloadDoors:
|
||||||
|
case ServerOP_ReloadDataBucketsCache:
|
||||||
case ServerOP_ReloadGroundSpawns:
|
case ServerOP_ReloadGroundSpawns:
|
||||||
case ServerOP_ReloadLevelEXPMods:
|
case ServerOP_ReloadLevelEXPMods:
|
||||||
case ServerOP_ReloadMerchants:
|
case ServerOP_ReloadMerchants:
|
||||||
|
|||||||
@ -8883,7 +8883,8 @@ void Client::ShowDevToolsMenu()
|
|||||||
menu_reload_two += Saylink::Silent("#reload commands", "Commands");
|
menu_reload_two += Saylink::Silent("#reload commands", "Commands");
|
||||||
menu_reload_two += " | " + Saylink::Silent("#reload content_flags", "Content Flags");
|
menu_reload_two += " | " + Saylink::Silent("#reload content_flags", "Content Flags");
|
||||||
|
|
||||||
menu_reload_three += Saylink::Silent("#reload doors", "Doors");
|
menu_reload_three += Saylink::Silent("#reload data_buckets_cache", "Databuckets");
|
||||||
|
menu_reload_three += " | " + Saylink::Silent("#reload doors", "Doors");
|
||||||
menu_reload_three += " | " + Saylink::Silent("#reload ground_spawns", "Ground Spawns");
|
menu_reload_three += " | " + Saylink::Silent("#reload ground_spawns", "Ground Spawns");
|
||||||
|
|
||||||
menu_reload_four += Saylink::Silent("#reload logs", "Level Based Experience Modifiers");
|
menu_reload_four += Saylink::Silent("#reload logs", "Level Based Experience Modifiers");
|
||||||
@ -10837,6 +10838,16 @@ void Client::SendReloadCommandMessages() {
|
|||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto data_buckets_link = Saylink::Silent("#reload data_buckets_cache");
|
||||||
|
|
||||||
|
Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Usage: {} - Reloads data buckets cache globally",
|
||||||
|
data_buckets_link
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
auto dztemplates_link = Saylink::Silent("#reload dztemplates");
|
auto dztemplates_link = Saylink::Silent("#reload dztemplates");
|
||||||
Message(Chat::White, fmt::format("Usage: {} - Reloads Dynamic Zone Templates globally", dztemplates_link).c_str());
|
Message(Chat::White, fmt::format("Usage: {} - Reloads Dynamic Zone Templates globally", dztemplates_link).c_str());
|
||||||
|
|
||||||
|
|||||||
@ -551,6 +551,8 @@ void DataBucket::HandleWorldMessage(ServerPacket *p)
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
if (n.update_action == DataBucketCacheUpdateAction::Delete) {
|
if (n.update_action == DataBucketCacheUpdateAction::Delete) {
|
||||||
|
DeleteFromMissesCache(n.e);
|
||||||
|
|
||||||
g_data_bucket_cache.erase(
|
g_data_bucket_cache.erase(
|
||||||
std::remove_if(
|
std::remove_if(
|
||||||
g_data_bucket_cache.begin(),
|
g_data_bucket_cache.begin(),
|
||||||
@ -577,23 +579,23 @@ void DataBucket::HandleWorldMessage(ServerPacket *p)
|
|||||||
|
|
||||||
// update
|
// update
|
||||||
bool has_key = false;
|
bool has_key = false;
|
||||||
|
|
||||||
for (auto &ce: g_data_bucket_cache) {
|
for (auto &ce: g_data_bucket_cache) {
|
||||||
int64 time_delta = ce.updated_time - n.updated_time;
|
|
||||||
if (ce.updated_time >= n.updated_time) {
|
|
||||||
LogDataBuckets(
|
|
||||||
"Attempted to update older cache key [{}] rejecting old time [{}] new time [{}] delta [{}] cache_size [{}]",
|
|
||||||
ce.e.key_,
|
|
||||||
ce.updated_time,
|
|
||||||
n.updated_time,
|
|
||||||
time_delta,
|
|
||||||
g_data_bucket_cache.size()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update cache
|
// update cache
|
||||||
if (ce.e.id == n.e.id) {
|
if (ce.e.id == n.e.id) {
|
||||||
|
// reject old updates
|
||||||
|
int64 time_delta = ce.updated_time - n.updated_time;
|
||||||
|
if (ce.updated_time >= n.updated_time) {
|
||||||
|
LogDataBuckets(
|
||||||
|
"Attempted to update older cache key [{}] rejecting old time [{}] new time [{}] delta [{}] cache_size [{}]",
|
||||||
|
ce.e.key_,
|
||||||
|
ce.updated_time,
|
||||||
|
n.updated_time,
|
||||||
|
time_delta,
|
||||||
|
g_data_bucket_cache.size()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DeleteFromMissesCache(n.e);
|
DeleteFromMissesCache(n.e);
|
||||||
|
|
||||||
LogDataBuckets(
|
LogDataBuckets(
|
||||||
@ -663,3 +665,9 @@ void DataBucket::DeleteFromMissesCache(DataBucketsRepository::DataBuckets e)
|
|||||||
g_data_bucket_cache.size()
|
g_data_bucket_cache.size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataBucket::ClearCache()
|
||||||
|
{
|
||||||
|
g_data_bucket_cache.clear();
|
||||||
|
LogInfo("Cleared data buckets cache");
|
||||||
|
}
|
||||||
|
|||||||
@ -88,6 +88,7 @@ public:
|
|||||||
static bool SendDataBucketCacheUpdate(const DataBucketCacheEntry &e);
|
static bool SendDataBucketCacheUpdate(const DataBucketCacheEntry &e);
|
||||||
static void HandleWorldMessage(ServerPacket *p);
|
static void HandleWorldMessage(ServerPacket *p);
|
||||||
static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e);
|
static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e);
|
||||||
|
static void ClearCache();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_DATABUCKET_H
|
#endif //EQEMU_DATABUCKET_H
|
||||||
|
|||||||
@ -18,6 +18,7 @@ void command_reload(Client *c, const Seperator *sep)
|
|||||||
bool is_blocked_spells = !strcasecmp(sep->arg[1], "blocked_spells");
|
bool is_blocked_spells = !strcasecmp(sep->arg[1], "blocked_spells");
|
||||||
bool is_commands = !strcasecmp(sep->arg[1], "commands");
|
bool is_commands = !strcasecmp(sep->arg[1], "commands");
|
||||||
bool is_content_flags = !strcasecmp(sep->arg[1], "content_flags");
|
bool is_content_flags = !strcasecmp(sep->arg[1], "content_flags");
|
||||||
|
bool is_data_buckets = !strcasecmp(sep->arg[1], "data_buckets_cache");
|
||||||
bool is_doors = !strcasecmp(sep->arg[1], "doors");
|
bool is_doors = !strcasecmp(sep->arg[1], "doors");
|
||||||
bool is_dztemplates = !strcasecmp(sep->arg[1], "dztemplates");
|
bool is_dztemplates = !strcasecmp(sep->arg[1], "dztemplates");
|
||||||
bool is_ground_spawns = !strcasecmp(sep->arg[1], "ground_spawns");
|
bool is_ground_spawns = !strcasecmp(sep->arg[1], "ground_spawns");
|
||||||
@ -46,6 +47,7 @@ void command_reload(Client *c, const Seperator *sep)
|
|||||||
!is_blocked_spells &&
|
!is_blocked_spells &&
|
||||||
!is_commands &&
|
!is_commands &&
|
||||||
!is_content_flags &&
|
!is_content_flags &&
|
||||||
|
!is_data_buckets &&
|
||||||
!is_doors &&
|
!is_doors &&
|
||||||
!is_dztemplates &&
|
!is_dztemplates &&
|
||||||
!is_ground_spawns &&
|
!is_ground_spawns &&
|
||||||
@ -92,6 +94,9 @@ void command_reload(Client *c, const Seperator *sep)
|
|||||||
} else if (is_doors) {
|
} else if (is_doors) {
|
||||||
c->Message(Chat::White, "Attempting to reload Doors globally.");
|
c->Message(Chat::White, "Attempting to reload Doors globally.");
|
||||||
pack = new ServerPacket(ServerOP_ReloadDoors, 0);
|
pack = new ServerPacket(ServerOP_ReloadDoors, 0);
|
||||||
|
} else if (is_data_buckets) {
|
||||||
|
c->Message(Chat::White, "Attempting to flush data buckets cache globally.");
|
||||||
|
pack = new ServerPacket(ServerOP_ReloadDataBucketsCache, 0);
|
||||||
} else if (is_dztemplates) {
|
} else if (is_dztemplates) {
|
||||||
c->Message(Chat::White, "Attempting to reload Dynamic Zone Templates globally.");
|
c->Message(Chat::White, "Attempting to reload Dynamic Zone Templates globally.");
|
||||||
pack = new ServerPacket(ServerOP_ReloadDzTemplates, 0);
|
pack = new ServerPacket(ServerOP_ReloadDzTemplates, 0);
|
||||||
|
|||||||
@ -2004,6 +2004,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset(), true);
|
RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ServerOP_ReloadDataBucketsCache:
|
||||||
|
{
|
||||||
|
zone->SendReloadMessage("Data buckets cache");
|
||||||
|
DataBucket::ClearCache();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ServerOP_ReloadDoors:
|
case ServerOP_ReloadDoors:
|
||||||
case ServerOP_ReloadGroundSpawns:
|
case ServerOP_ReloadGroundSpawns:
|
||||||
case ServerOP_ReloadObjects:
|
case ServerOP_ReloadObjects:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user