mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
31
src/common/Asio/SteadyTimer.h
Normal file
31
src/common/Asio/SteadyTimer.h
Normal 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
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user