MCPcopy Create free account
hub / github.com/tbphp/gpt-load / UpdateProgress

Method UpdateProgress

internal/services/task_service.go:102–118  ·  view source on GitHub ↗

UpdateProgress updates the progress of the current task.

(processed int)

Source from the content-addressed store, hash-verified

100
101// UpdateProgress updates the progress of the current task.
102func (s *TaskService) UpdateProgress(processed int) error {
103 status, err := s.GetTaskStatus()
104 if err != nil {
105 return err
106 }
107 if !status.IsRunning {
108 return nil
109 }
110
111 status.Processed = processed
112 statusBytes, err := json.Marshal(status)
113 if err != nil {
114 return fmt.Errorf("failed to serialize updated status: %w", err)
115 }
116
117 return s.store.Set(globalTaskKey, statusBytes, ResultTTL)
118}
119
120// EndTask marks the current task as finished and stores its final result.
121func (s *TaskService) EndTask(resultData any, taskErr error) error {

Callers 3

runDeleteMethod · 0.80
runImportMethod · 0.80
runValidationMethod · 0.80

Calls 2

GetTaskStatusMethod · 0.95
SetMethod · 0.65

Tested by

no test coverage detected