Removed obsolete func

This commit is contained in:
emeric
2025-09-13 15:18:32 +02:00
parent 932e7715f5
commit fc70483791
5 changed files with 17 additions and 17 deletions
+2 -1
View File
@@ -19,6 +19,7 @@
#include "SendQueue.hpp"
#include <algorithm>
#include <latch>
#include <boost/asio/bind_executor.hpp>
@@ -308,7 +309,7 @@ namespace lms::core::http
void SendQueue::throttle(std::chrono::seconds requestedDuration)
{
const std::chrono::seconds duration{ clamp(requestedDuration, _minRetryWaitDuration, _maxRetryWaitDuration) };
const std::chrono::seconds duration{ std::clamp(requestedDuration, _minRetryWaitDuration, _maxRetryWaitDuration) };
LOG(DEBUG, "Throttling for " << duration.count() << " seconds");
_throttleTimer.expires_after(duration);
+7 -10
View File
@@ -24,19 +24,16 @@
namespace lms::core::utils
{
template<class T, class Compare = std::less<>>
constexpr T clamp(T v, T lo, T hi, Compare comp = {})
{
assert(!comp(hi, lo));
return comp(v, lo) ? lo : comp(hi, v) ? hi :
v;
}
template<typename Container, typename T>
void
push_back_if_not_present(Container& container, const T& val)
void push_back_if_not_present(Container& container, const T& val)
{
if (std::find(std::cbegin(container), std::cend(container), val) == std::cend(container))
container.push_back(val);
}
template<class... Ts>
struct overloads : Ts...
{
using Ts::operator()...;
};
} // namespace lms::core::utils