mirror of
https://github.com/ollama/ollama.git
synced 2026-01-29 07:12:03 +03:00
address comment
This commit is contained in:
10
app/ui/ui.go
10
app/ui/ui.go
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user