MCPcopy
hub / github.com/mudler/LocalAI / UpdateProgress

Method UpdateProgress

core/services/distributed/gallery.go:87–95  ·  view source on GitHub ↗

UpdateProgress updates progress for an operation. The cancellable flag is persisted on every tick so a replica that restarts mid-install rehydrates the op as still cancellable — otherwise the column keeps its Create-time zero value (false), the UI hides the cancel button, and the orphaned op can onl

(id string, progress float64, message, downloadedSize string, cancellable bool)

Source from the content-addressed store, hash-verified

85// value (false), the UI hides the cancel button, and the orphaned op can only
86// be dismissed by waiting for the 30-minute stale reaper.
87func (s *GalleryStore) UpdateProgress(id string, progress float64, message, downloadedSize string, cancellable bool) error {
88 return s.db.Model(&GalleryOperationRecord{}).Where("id = ?", id).Updates(map[string]any{
89 "progress": progress,
90 "message": message,
91 "downloaded_file_size": downloadedSize,
92 "cancellable": cancellable,
93 "updated_at": time.Now(),
94 }).Error
95}
96
97// UpdateStatus updates the status of an operation. A terminal status is never
98// cancellable, so the flag is cleared here to keep the persisted row consistent

Callers 3

UpdateStatusMethod · 0.80
phase4_test.goFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected