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() void ExpeditionDatabase::PurgeExpiredExpeditions()
{ {
LogExpeditionsDetail("Purging expired expeditions");
std::string query = SQL( std::string query = SQL(
DELETE expedition FROM expedition_details expedition DELETE expedition FROM expedition_details expedition
LEFT JOIN instance_list ON expedition.instance_id = instance_list.id 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(); OR (instance_list.start_time + instance_list.duration) <= UNIX_TIMESTAMP();
); );
auto results = database.QueryDatabase(query); database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to purge expired and empty expeditions");
}
} }
void ExpeditionDatabase::PurgeExpiredCharacterLockouts() void ExpeditionDatabase::PurgeExpiredCharacterLockouts()
{ {
LogExpeditionsDetail("Purging expired lockouts");
std::string query = SQL( std::string query = SQL(
DELETE FROM expedition_character_lockouts DELETE FROM expedition_character_lockouts
WHERE expire_time <= NOW(); WHERE expire_time <= NOW();
); );
auto results = database.QueryDatabase(query); database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to purge expired lockouts");
}
} }
std::vector<Expedition> ExpeditionDatabase::LoadExpeditions() std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
{ {
LogExpeditionsDetail("Loading expeditions for world cache");
std::vector<Expedition> expeditions; std::vector<Expedition> expeditions;
std::string query = SQL( std::string query = SQL(
@ -262,11 +260,7 @@ std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
); );
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) if (results.Success())
{
LogExpeditions("Failed to load expeditions for world cache");
}
else
{ {
uint32_t last_expedition_id = 0; uint32_t last_expedition_id = 0;
@ -297,6 +291,8 @@ std::vector<Expedition> ExpeditionDatabase::LoadExpeditions()
Expedition ExpeditionDatabase::LoadExpedition(uint32_t expedition_id) Expedition ExpeditionDatabase::LoadExpedition(uint32_t expedition_id)
{ {
LogExpeditions("Loading expedition [{}] for world cache", expedition_id);
Expedition expedition; Expedition expedition;
std::string query = fmt::format(SQL( std::string query = fmt::format(SQL(
@ -316,11 +312,7 @@ Expedition ExpeditionDatabase::LoadExpedition(uint32_t expedition_id)
), expedition_id); ), expedition_id);
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) if (results.Success())
{
LogExpeditions("Failed to load expedition [{}] for world cache", expedition_id);
}
else
{ {
bool created = false; bool created = false;
for (auto row = results.begin(); row != results.end(); ++row) 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) void DynamicZone::SaveInstanceMembersToDatabase(const std::unordered_set<uint32_t>& character_ids)
{ {
LogDynamicZonesDetail("Saving [{}] instance members to database", character_ids.size());
std::string insert_values; std::string insert_values;
for (const auto& character_id : character_ids) 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 {}; REPLACE INTO instance_list_player (id, charid) VALUES {};
), insert_values); ), insert_values);
auto results = database.QueryDatabase(query); database.QueryDatabase(query);
if (!results.Success())
{
LogDynamicZones("Failed to save instance members to database");
}
} }
} }

View File

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