Closed fwsmit closed 1 year ago
@bakkeby Your fix seems to work. Could you submit it or something similar as a PR?
Sure, I'll raise one.
Fixed with #1164
I've been consistently struggling with this issue for a while (and sorry to say without putting effort into solving it). I built from master
after #1168 yesterday and have seen no trace of CPU spin ups since. Great work! :+1:
Described by @bakkeby:
As per the comment in the dunst config file the
show_age_threshold
can be set to -1 to disable the display of the age of a message.In
queues_get_next_datachange
if there are no messages that are timing out (i.e. they are permanent until the user interacts with them) then the function will return-1
.https://github.com/dunst-project/dunst/blob/464076d4054811bc7261f2ed684b5713b18fdf51/src/queues.c#L589
Now in the
run
function we do not take into account that the return value can be -1 indicating that there is no need to do any further updates.https://github.com/dunst-project/dunst/blob/464076d4054811bc7261f2ed684b5713b18fdf51/src/dunst.c#L95-L115
The solution can be as simple as bailing if that is the case:
(there are other ways to refactor the code to the same effect of course)
Example test scenario is to:
show_age_threshold
to-1
in the dunstrc configuration file andtop -p $(pidof dunst)
to monitor CPU usage andnotify-send -u critical hello
Expected behaviour without the change above:
Expected behaviour with the change above: