Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-12-31 17:18:40 +08:00
102 changed files with 2247 additions and 409 deletions

View File

@@ -0,0 +1,31 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _STEADYTIMER_H
#define _STEADYTIMER_H
#include <chrono>
namespace Acore::Asio::SteadyTimer
{
inline auto GetExpirationTime(int32 seconds)
{
return std::chrono::steady_clock::now() + std::chrono::seconds(seconds);
}
}
#endif // _STEADYTIMER_H

View File

@@ -66,7 +66,7 @@ void Appender::write(LogMessage* message)
if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
{
ss << Acore::StringFormat("%-5s ", Appender::getLogLevelString(message->level));
ss << Acore::StringFormat("{} ", Appender::getLogLevelString(message->level));
}
if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)

View File

@@ -18,6 +18,7 @@
#include "Metric.h"
#include "Config.h"
#include "Log.h"
#include "SteadyTimer.h"
#include "Strand.h"
#include "Tokenize.h"
#include <boost/algorithm/string/replace.hpp>
@@ -246,9 +247,7 @@ void Metric::ScheduleSend()
{
if (_enabled)
{
// Calculate the expiration time
auto expirationTime = std::chrono::steady_clock::now() + std::chrono::seconds(_updateInterval);
_batchTimer->expires_at(expirationTime);
_batchTimer->expires_at(Acore::Asio::SteadyTimer::GetExpirationTime(_updateInterval));
_batchTimer->async_wait(std::bind(&Metric::SendBatch, this));
}
else
@@ -281,9 +280,7 @@ void Metric::ScheduleOverallStatusLog()
{
if (_enabled)
{
// Calculate the expiration time _overallStatusTimerInterval from now
auto expirationTime = std::chrono::steady_clock::now() + std::chrono::seconds(_overallStatusTimerInterval);
_overallStatusTimer->expires_at(expirationTime);
_overallStatusTimer->expires_at(Acore::Asio::SteadyTimer::GetExpirationTime(_overallStatusTimerInterval));
_overallStatusTimer->async_wait([this](const boost::system::error_code&)
{
_overallStatusTimerTriggered = true;