refactor(eventloop): Use config wrapper
This commit is contained in:
parent
b156d1bbf4
commit
8c3f40db5b
@ -17,6 +17,7 @@ using boost::none;
|
|||||||
|
|
||||||
#define GET_CONFIG_VALUE(section, var, name) var = m_conf.get<decltype(var)>(section, name, var)
|
#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 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(value_error);
|
||||||
DEFINE_ERROR(key_error);
|
DEFINE_ERROR(key_error);
|
||||||
|
@ -119,7 +119,7 @@ class eventloop : public signal_receiver<SIGN_PRIORITY_EVENTLOOP, process_quit,
|
|||||||
/**
|
/**
|
||||||
* @brief Time to throttle input events
|
* @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
|
* @brief Mutex used to guard input data
|
||||||
|
@ -26,11 +26,9 @@ eventloop::make_type eventloop::make() {
|
|||||||
*/
|
*/
|
||||||
eventloop::eventloop(signal_emitter& emitter, const logger& logger, const config& config)
|
eventloop::eventloop(signal_emitter& emitter, const logger& logger, const config& config)
|
||||||
: m_sig(emitter), m_log(logger), m_conf(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);
|
GET_CONFIG_VALUE("settings", m_swallow_input, "throttle-input-for");
|
||||||
m_swallow_update = m_conf.deprecated<chrono::milliseconds>(
|
DEPR_CONFIG_VALUE("settings", m_swallow_limit, "eventloop-swallow", "throttle-output");
|
||||||
"settings", "eventloop-swallow-time", "throttle-output-for", m_swallow_update);
|
DEPR_CONFIG_VALUE("settings", m_swallow_update, "eventloop-swallow-time", "throttle-output-for");
|
||||||
m_swallow_input =
|
|
||||||
m_conf.get<chrono::milliseconds>("settings", "throttle-input-for", m_swallow_update * m_swallow_limit);
|
|
||||||
m_sig.attach(this);
|
m_sig.attach(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user