diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-06-19 22:09:19 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-06-22 11:36:47 +0200 |
commit | de24d2d5909adee29ea7adea9b22fbf1d02b7502 (patch) | |
tree | ae966f7f0a947f07a5040b702e39aac54d5638b7 /worker | |
parent | be2abb3d91fe19f8a90f550f7dce872ac5115ead (diff) | |
download | aerc-de24d2d5909adee29ea7adea9b22fbf1d02b7502.tar.gz |
config: fix setting of zero-value time.Duration config values
When using section.MapTo(struct) (go-ini), if the struct has a default
value for a time.Duration type, a zero-value in the config will not
overwrite the default. If the type is *time.Duration, it will be
overwritten properly. One consideration was to change all
time.Duration types to *time.Duration. This method was chosen for ease
of implementation.
For example, if you set dirlist-delay = 0s, the delay will be 200ms.
This can be observed by logging the value just after mapping the ui
section in config.go. A config value of 0.1ms will have a delay of
0.1ms.
Currently, aerc has 4 time.Duration config values:
1. DirlistDelay - default 200 ms
2. CompletionDelay - default 250 ms
3. CheckMail - default unset (0)
4. CheckMailTimeout - default 10 s
1, 2, and 4 have a non-zero default value and are subject to this bug.
Only 1 and 2 are fixed in this patch. Number 4 would not make sense to
have a 0 second timeout, therefore we can prevent the user from doing
this by keeping it as it is.
Another option could be to set these to 0 in config.go. The default
config (aerc.conf) has these keys in it with their default values.
Presumably, we don't need to set them again in config.go. If a user
deletes the config values out of aerc.conf, the UI will function but
with 0s delays.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'worker')
0 files changed, 0 insertions, 0 deletions