ENH collect garbage only during startup

FIX ac power bug
This commit is contained in:
Nathan Dwarshuis 2019-10-12 18:14:38 -04:00
parent 0fe00472d3
commit ea5bfb5e85
1 changed files with 4 additions and 5 deletions

View File

@ -171,17 +171,17 @@ cr_static = nil
local using_ac = function() local using_ac = function()
-- for some reason it is much more efficient to test if the battery -- for some reason it is much more efficient to test if the battery
-- is off than if the ac is on -- is off than if the ac is on
return Util.read_file('/sys/class/power_supply/BAT0/status') ~= 'Discharging' return Util.read_file('/sys/class/power_supply/BAT0/status', nil, '*l') ~= 'Discharging'
end end
-- --
-- main loop -- main loop
-- --
local updates = -2 -- this accounts for the first few spazzy iterations local updates = -2 -- this accounts for the first few spazzy iterations
local __collectgarbage = collectgarbage
local STATS_FILE = '/tmp/.conky_pacman' local STATS_FILE = '/tmp/.conky_pacman'
collectgarbage() -- clear out the widget constructors
function conky_main() function conky_main()
local _cw = conky_window local _cw = conky_window
if not _cw then return end if not _cw then return end
@ -214,5 +214,4 @@ function conky_main()
__cairo_surface_destroy(cs) __cairo_surface_destroy(cs)
__cairo_destroy(cr) __cairo_destroy(cr)
__collectgarbage()
end end