Remove logging of expedition query failures

This is redundant with sql error logging. Logging the operations is
enough to determine the source of any errors
This commit is contained in:
hg 2020-06-14 17:16:03 -04:00
parent ea0b37b7fc
commit 4af5f79328
3 changed files with 26 additions and 83 deletions

View File

@ -205,6 +205,8 @@ void ExpeditionCache::Process()
void ExpeditionDatabase::PurgeExpiredExpeditions()
{
LogExpeditionsDetail("Purging expired expeditions");
std::string query = SQL(
DELETE expedition FROM expedition_details expedition
LEFT JOIN instance_list ON expedition.instance_id = instance_list.id
@ -220,29 +222,25 @@ void ExpeditionDatabase::PurgeExpiredExpeditions()
OR (instance_list.start_time + instance_list.duration) <= UNIX_TIMESTAMP();
);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to purge expired and empty expeditions");
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::PurgeExpiredCharacterLockouts()
{
LogExpeditionsDetail("Purging expired lockouts");
std::string query = SQL(
DELETE FROM expedition_character_lockouts
WHERE expire_time <= NOW();
);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to purge expired lockouts");
}
database.QueryDatabase(query);
}
std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
{
LogExpeditionsDetail("Loading expeditions for world cache");
std::vector<Expedition> expeditions;
std::string query = SQL(
@ -262,11 +260,7 @@ std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to load expeditions for world cache");
}
else
if (results.Success())
{
uint32_t last_expedition_id = 0;
@ -297,6 +291,8 @@ std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
Expedition ExpeditionDatabase::LoadExpedition(uint32_t expedition_id)
{
LogExpeditions("Loading expedition [{}] for world cache", expedition_id);
Expedition expedition;
std::string query = fmt::format(SQL(
@ -316,11 +312,7 @@ Expedition ExpeditionDatabase::LoadExpedition(uint32_t expedition_id)
), expedition_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to load expedition [{}] for world cache", expedition_id);
}
else
if (results.Success())
{
bool created = false;
for (auto row = results.begin(); row != results.end(); ++row)

View File

@ -429,6 +429,8 @@ void DynamicZone::RemoveAllCharacters(bool enable_removal_timers)
void DynamicZone::SaveInstanceMembersToDatabase(const std::unordered_set<uint32_t>& character_ids)
{
LogDynamicZonesDetail("Saving [{}] instance members to database", character_ids.size());
std::string insert_values;
for (const auto& character_id : character_ids)
{
@ -443,11 +445,7 @@ void DynamicZone::SaveInstanceMembersToDatabase(const std::unordered_set<uint32_
REPLACE INTO instance_list_player (id, charid) VALUES {};
), insert_values);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogDynamicZones("Failed to save instance members to database");
}
database.QueryDatabase(query);
}
}

View File

@ -308,14 +308,7 @@ void ExpeditionDatabase::DeleteCharacterLockout(
AND event_name = '{}';
), character_id, expedition_name, event_name);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions(
"Failed to delete [{}] event [{}] lockout from character [{}]",
expedition_name, event_name, character_id
);
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::DeleteMembersLockout(
@ -343,11 +336,7 @@ void ExpeditionDatabase::DeleteMembersLockout(
AND event_name = '{}';
), query_character_ids, expedition_name, event_name);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to delete [{}] event [{}] lockouts", expedition_name, event_name);
}
database.QueryDatabase(query);
}
}
@ -411,11 +400,7 @@ void ExpeditionDatabase::DeleteLockout(uint32_t expedition_id, const std::string
WHERE expedition_id = {} AND event_name = '{}';
), expedition_id, event_name);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to delete expedition [{}] lockout [{}]", expedition_id, event_name);
}
database.QueryDatabase(query);
}
uint32_t ExpeditionDatabase::GetExpeditionIDFromCharacterID(uint32_t character_id)
@ -571,11 +556,7 @@ void ExpeditionDatabase::InsertLockout(
ON DUPLICATE KEY UPDATE expire_time = VALUES(expire_time);
), expedition_id, lockout.GetEventName(), lockout.GetExpireTime(), lockout.GetDuration());
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to insert expedition lockouts");
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::InsertLockouts(
@ -607,11 +588,7 @@ void ExpeditionDatabase::InsertLockouts(
ON DUPLICATE KEY UPDATE expire_time = VALUES(expire_time);
), insert_values);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to insert expedition lockouts");
}
database.QueryDatabase(query);
}
}
@ -627,11 +604,7 @@ void ExpeditionDatabase::InsertMember(uint32_t expedition_id, uint32_t character
ON DUPLICATE KEY UPDATE is_current_member = TRUE;
), expedition_id, character_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to insert [{}] to expedition [{}]", character_id, expedition_id);
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::InsertMembers(
@ -657,11 +630,7 @@ void ExpeditionDatabase::InsertMembers(
VALUES {};
), insert_values);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to save expedition members to database");
}
database.QueryDatabase(query);
}
}
@ -673,11 +642,7 @@ void ExpeditionDatabase::UpdateLeaderID(uint32_t expedition_id, uint32_t leader_
UPDATE expedition_details SET leader_id = {} WHERE id = {};
), leader_id, expedition_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to update expedition [{}] leader", expedition_id);
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::UpdateLockState(uint32_t expedition_id, bool is_locked)
@ -688,11 +653,7 @@ void ExpeditionDatabase::UpdateLockState(uint32_t expedition_id, bool is_locked)
UPDATE expedition_details SET is_locked = {} WHERE id = {};
), is_locked, expedition_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to update expedition [{}] lock state", expedition_id);
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::UpdateMemberRemoved(uint32_t expedition_id, uint32_t character_id)
@ -704,11 +665,7 @@ void ExpeditionDatabase::UpdateMemberRemoved(uint32_t expedition_id, uint32_t ch
WHERE expedition_id = {} AND character_id = {};
), expedition_id, character_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to remove [{}] from expedition [{}]", character_id, expedition_id);
}
database.QueryDatabase(query);
}
void ExpeditionDatabase::UpdateAllMembersRemoved(uint32_t expedition_id)
@ -731,9 +688,5 @@ void ExpeditionDatabase::UpdateReplayLockoutOnJoin(uint32_t expedition_id, bool
UPDATE expedition_details SET add_replay_on_join = {} WHERE id = {};
), add_on_join, expedition_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to update expedition [{}] replay timer setting", expedition_id);
}
database.QueryDatabase(query);
}