refactor(eventloop): Use config wrapper

This commit is contained in:
Michael Carlberg 2016-12-14 07:46:37 +01:00
parent b156d1bbf4
commit 8c3f40db5b
3 changed files with 5 additions and 6 deletions

View File

@ -17,6 +17,7 @@ using boost::none;
#define GET_CONFIG_VALUE(section, var, name) var = m_conf.get<decltype(var)>(section, name, var)
#define REQ_CONFIG_VALUE(section, var, name) var = m_conf.get<decltype(var)>(section, name)
#define DEPR_CONFIG_VALUE(section, var, old, name) var = m_conf.deprecated<decltype(var)>(section, old, name, var)
DEFINE_ERROR(value_error);
DEFINE_ERROR(key_error);

View File

@ -119,7 +119,7 @@ class eventloop : public signal_receiver<SIGN_PRIORITY_EVENTLOOP, process_quit,
/**
* @brief Time to throttle input events
*/
chrono::milliseconds m_swallow_input{0};
chrono::milliseconds m_swallow_input{30ms};
/**
* @brief Mutex used to guard input data

View File

@ -26,11 +26,9 @@ eventloop::make_type eventloop::make() {
*/
eventloop::eventloop(signal_emitter& emitter, const logger& logger, const config& config)
: m_sig(emitter), m_log(logger), m_conf(config) {
m_swallow_limit = m_conf.deprecated<size_t>("settings", "eventloop-swallow", "throttle-output", m_swallow_limit);
m_swallow_update = m_conf.deprecated<chrono::milliseconds>(
"settings", "eventloop-swallow-time", "throttle-output-for", m_swallow_update);
m_swallow_input =
m_conf.get<chrono::milliseconds>("settings", "throttle-input-for", m_swallow_update * m_swallow_limit);
GET_CONFIG_VALUE("settings", m_swallow_input, "throttle-input-for");
DEPR_CONFIG_VALUE("settings", m_swallow_limit, "eventloop-swallow", "throttle-output");
DEPR_CONFIG_VALUE("settings", m_swallow_update, "eventloop-swallow-time", "throttle-output-for");
m_sig.attach(this);
}