Skip to content

Commit d4c4b62

Browse files
committed
fix: save update check result to cache for dashboard notification
1 parent e393960 commit d4c4b62

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cmd/push-validator/cmd_update.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os/exec"
88
"path/filepath"
99
"strings"
10+
"time"
1011

1112
"github.com/pushchain/push-validator-cli/internal/update"
1213
ui "github.com/pushchain/push-validator-cli/internal/ui"
@@ -59,6 +60,15 @@ Examples:
5960
latestVersion := strings.TrimPrefix(release.TagName, "v")
6061
currentVersion := strings.TrimPrefix(Version, "v")
6162

63+
// Save result to cache for dashboard/background check
64+
cfg := loadCfg()
65+
updateAvailable := update.IsNewerVersion(Version, release.TagName)
66+
_ = update.SaveCache(cfg.HomeDir, &update.CacheEntry{
67+
CheckedAt: time.Now(),
68+
LatestVersion: latestVersion,
69+
UpdateAvailable: updateAvailable,
70+
})
71+
6272
// Check if update needed
6373
if !force && !update.IsNewerVersion(Version, release.TagName) {
6474
p.Success(fmt.Sprintf("Already up to date (v%s)", currentVersion))

0 commit comments

Comments
 (0)