mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 17:38:26 +00:00
Check for empty expedition via database not cache
Checking the cache on member removal here isn't reliable due to race with cross zone message If a zone removes a member at the same time as another zone, neither zone can know if the expedition will be empty via cache unless it processes the world message from the other zone's member removal first.
This commit is contained in:
@@ -419,6 +419,25 @@ ExpeditionMember ExpeditionDatabase::GetExpeditionLeader(uint32_t expedition_id)
|
||||
return leader;
|
||||
}
|
||||
|
||||
uint32_t ExpeditionDatabase::GetExpeditionMemberCount(uint32_t expedition_id)
|
||||
{
|
||||
auto query = fmt::format(SQL(
|
||||
SELECT COUNT(IF(is_current_member = TRUE, 1, NULL)) member_count
|
||||
FROM expedition_members
|
||||
WHERE expedition_id = {};
|
||||
), expedition_id);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
uint32_t member_count = 0;
|
||||
if (results.Success() && results.RowCount() > 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
member_count = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
}
|
||||
return member_count;
|
||||
}
|
||||
|
||||
void ExpeditionDatabase::InsertCharacterLockouts(
|
||||
uint32_t character_id, const std::vector<ExpeditionLockoutTimer>& lockouts,
|
||||
bool update_expire_times, bool is_pending)
|
||||
|
||||
Reference in New Issue
Block a user