Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/tscore/Throttler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ class Throttler
* @return True if the action is suppressed per the configured interval,
* false otherwise.
*/
virtual bool is_throttled(uint64_t &suppressed_count);
bool is_throttled(uint64_t &suppressed_count);

/** Set the log throttling interval to a new value.
*
* @param[in] interval The new interval to set.
*/
virtual void set_throttling_interval(std::chrono::microseconds new_interval);
void set_throttling_interval(std::chrono::microseconds new_interval);

/** Manually reset the throttling counter to the current time.
*
* @return the number of messages skipped since the previous positive return
* of the functor operator.
*/
virtual uint64_t reset_counter();
uint64_t reset_counter();

private:
/// Base clock.
using Clock = std::chrono::system_clock;
using Clock = std::chrono::steady_clock;

/** A time_point with a noexcept constructor.
*
Expand All @@ -125,7 +125,7 @@ class Throttler
};

/// Time that the last item was emitted.
std::atomic<TimePoint> _last_allowed_time;
std::atomic<TimePoint> _last_allowed_time{TimePoint()};

/// The minimum number of microseconds desired between actions.
std::atomic<std::chrono::microseconds> _interval{std::chrono::microseconds{0}};
Expand Down