(ctx context.Context, cfg *config.Config)
| 76 | } |
| 77 | |
| 78 | func (s *Service) processHomePluginTasks(ctx context.Context, cfg *config.Config) { |
| 79 | if s == nil || cfg == nil || !cfg.Home.Enabled || s.homeClient == nil { |
| 80 | return |
| 81 | } |
| 82 | if ctx == nil { |
| 83 | ctx = context.Background() |
| 84 | } |
| 85 | tasks, errTasks := s.homeClient.GetPluginTasks(ctx) |
| 86 | if errTasks != nil { |
| 87 | log.Warnf("failed to fetch home plugin tasks: %v", errTasks) |
| 88 | return |
| 89 | } |
| 90 | for _, task := range tasks { |
| 91 | if !strings.EqualFold(strings.TrimSpace(task.Operation), "delete") { |
| 92 | continue |
| 93 | } |
| 94 | report := s.processHomePluginDeleteTask(ctx, cfg, task) |
| 95 | if !report.OK && strings.TrimSpace(report.Error) != "" { |
| 96 | log.Warnf("failed to process home plugin delete task %d for %s: %v", task.ID, task.PluginID, report.Error) |
| 97 | } |
| 98 | s.reportHomePluginStatus(ctx, cfg, report) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func (s *Service) processHomePluginDeleteTask(ctx context.Context, cfg *config.Config, task home.PluginTask) homeplugins.SyncReport { |
| 103 | return homeplugins.DeleteWithReport(ctx, cfg, s.pluginHost, task.ID, task.PluginID) |
no test coverage detected