fix(nix-monitor): make the delay only on startup
This commit is contained in:
@@ -32,7 +32,7 @@ local storeSizeFile = stateDir .. "/storeSize"
|
|||||||
local closureSizeFile = stateDir .. "/closureSize"
|
local closureSizeFile = stateDir .. "/closureSize"
|
||||||
|
|
||||||
local localHashCmd = "nixos-version --hash 2> /dev/null | cut -c -7 > " .. localHashFile .. " &"
|
local localHashCmd = "nixos-version --hash 2> /dev/null | cut -c -7 > " .. localHashFile .. " &"
|
||||||
local remoteHashCmd = "sleep 5 && git ls-remote https://github.com/NixOS/nixpkgs " .. branch .. " 2>/dev/null | cut -c 1-7 > " .. remoteHashFile .. " &"
|
local remoteHashCmd = "git ls-remote https://github.com/NixOS/nixpkgs " .. branch .. " 2>/dev/null | cut -c 1-7 > " .. remoteHashFile .. " &"
|
||||||
local nixosGenerationsCmd = "nixos-rebuild list-generations | tail -n +2 | wc -l"
|
local nixosGenerationsCmd = "nixos-rebuild list-generations | tail -n +2 | wc -l"
|
||||||
local nixosCurrentGenCmd = "nixos-rebuild list-generations | grep True | awk '{print $1}'"
|
local nixosCurrentGenCmd = "nixos-rebuild list-generations | grep True | awk '{print $1}'"
|
||||||
local hmGenerationsCmd = "home-manager generations | wc -l"
|
local hmGenerationsCmd = "home-manager generations | wc -l"
|
||||||
@@ -63,7 +63,6 @@ noctalia.writeFile(remoteHashFile, "")
|
|||||||
|
|
||||||
function update()
|
function update()
|
||||||
if isInit or (os.time() - getState("lastCheckTime")) >= 60 * updateCheckInterval then
|
if isInit or (os.time() - getState("lastCheckTime")) >= 60 * updateCheckInterval then
|
||||||
isInit = false
|
|
||||||
cancelCheck()
|
cancelCheck()
|
||||||
checkUpdate()
|
checkUpdate()
|
||||||
end
|
end
|
||||||
@@ -96,6 +95,13 @@ function checkUpdate()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local remoteCmd = remoteHashCmd
|
||||||
|
|
||||||
|
if isInit then
|
||||||
|
remoteCmd = "sleep 10 && " .. remoteCmd
|
||||||
|
isInit = false
|
||||||
|
end
|
||||||
|
|
||||||
setState("lastRunTime", os.time())
|
setState("lastRunTime", os.time())
|
||||||
|
|
||||||
if cfg("show_checking_notification") then
|
if cfg("show_checking_notification") then
|
||||||
@@ -108,7 +114,7 @@ function checkUpdate()
|
|||||||
noctalia.writeFile(remoteHashFile, "")
|
noctalia.writeFile(remoteHashFile, "")
|
||||||
|
|
||||||
noctalia.runAsync(localHashCmd)
|
noctalia.runAsync(localHashCmd)
|
||||||
noctalia.runAsync(remoteHashCmd)
|
noctalia.runAsync(remoteCmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
function isCheckUpdateSuccessfully()
|
function isCheckUpdateSuccessfully()
|
||||||
|
|||||||
Reference in New Issue
Block a user