module/mem: rename ‘interval’ to ‘poll-interval’

This commit is contained in:
Daniel Eklöf 2022-12-18 10:40:04 +01:00
parent 63c9c90a61
commit cb8acf261a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 10 additions and 6 deletions

View file

@ -15,6 +15,7 @@
### Changed ### Changed
* disk-io: `interval` renamed to `poll-interval` * disk-io: `interval` renamed to `poll-interval`
* mem: `interval` renamed to `poll-interval`
### Deprecated ### Deprecated

View file

@ -30,10 +30,11 @@ mem - This module provides the memory usage
:[ *Type* :[ *Type*
:[ *Req* :[ *Req*
:< *Description* :< *Description*
| interval | poll-interval
: string : string
: no : no
: Refresh interval of the memory usage stats in ms (default=500). Cannot be less then 500 ms : Refresh interval of the memory usage stats in ms
(default=500). Cannot be less then 500 ms.
# EXAMPLES # EXAMPLES
@ -41,7 +42,7 @@ mem - This module provides the memory usage
bar: bar:
left: left:
- mem: - mem:
interval: 2500 poll-interval: 2500
content: content:
string: {text: "{used:mb}MB"} string: {text: "{used:mb}MB"}
``` ```

View file

@ -151,10 +151,12 @@ mem_new(uint16_t interval, struct particle *label)
static struct module * static struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited) from_conf(const struct yml_node *node, struct conf_inherit inherited)
{ {
const struct yml_node *interval = yml_get_value(node, "interval"); const struct yml_node *interval = yml_get_value(node, "poll-interval");
const struct yml_node *c = yml_get_value(node, "content"); const struct yml_node *c = yml_get_value(node, "content");
return mem_new(interval == NULL ? SMALLEST_INTERVAL : yml_value_as_int(interval), conf_to_particle(c, inherited)); return mem_new(
interval == NULL ? SMALLEST_INTERVAL : yml_value_as_int(interval),
conf_to_particle(c, inherited));
} }
static bool static bool
@ -175,7 +177,7 @@ static bool
verify_conf(keychain_t *chain, const struct yml_node *node) verify_conf(keychain_t *chain, const struct yml_node *node)
{ {
static const struct attr_info attrs[] = { static const struct attr_info attrs[] = {
{"interval", false, &conf_verify_interval}, {"poll-interval", false, &conf_verify_interval},
MODULE_COMMON_ATTRS, MODULE_COMMON_ATTRS,
}; };