1 #include "mfextensions/Extensions/throttle.hh"
4 : name_(name), expr_(regex_t(name)), limit_(limit), timespan_(timespan), last_window_start_(0), count_(0), in_use_(true) {}
13 if (!boost::regex_match(name, what_, expr_))
31 return count_ > limit_;
34 int64_t sec = tm.tv_sec;
35 if (sec - last_window_start_ > timespan_)
37 last_window_start_ = sec;
45 return count_ > limit_;
throttle(std::string const &name, int limit, int64_t timespan)
Throttle messages using a regular expression if they occurr above a certain frequency ...
bool reach_limit(std::string const &name, timeval tm)
Determine whether the name has reached the throttling limit