address comment

This commit is contained in:
Eva Ho
2026-01-22 14:25:52 -05:00
parent af05f2e58e
commit 4bd2afd22f
2 changed files with 6 additions and 10 deletions

View File

@@ -109,18 +109,10 @@ type Server struct {
Dev bool
// Updater for checking and downloading updates
Updater UpdaterInterface
Updater *updater.Updater
UpdateAvailableFunc func()
}
// UpdaterInterface defines the methods we need from the updater
type UpdaterInterface interface {
CheckForUpdate(ctx context.Context) (bool, string, error)
InstallAndRestart() error
CancelOngoingDownload()
TriggerImmediateCheck()
}
func (s *Server) log() *slog.Logger {
if s.Logger == nil {
return slog.Default()

View File

@@ -279,7 +279,11 @@ func (u *Updater) CancelOngoingDownload() {
// TriggerImmediateCheck signals the background checker to check for updates immediately
func (u *Updater) TriggerImmediateCheck() {
if u.checkNow != nil {
u.checkNow <- struct{}{}
select {
case u.checkNow <- struct{}{}:
default:
// Check already pending, no need to queue another
}
}
}