| 20 | const homePluginStatusReportTimeout = 10 * time.Second |
| 21 | |
| 22 | func (s *Service) syncHomePlugins(ctx context.Context, cfg *config.Config) (homeplugins.SyncReport, string, bool, error) { |
| 23 | if s == nil || cfg == nil || !cfg.Home.Enabled { |
| 24 | return homeplugins.SyncReport{}, "", false, nil |
| 25 | } |
| 26 | syncKey := homePluginSyncKey(cfg) |
| 27 | if syncKey != "" { |
| 28 | s.homePluginSyncMu.Lock() |
| 29 | if s.homePluginSyncKey == syncKey { |
| 30 | s.homePluginSyncMu.Unlock() |
| 31 | return homeplugins.SyncReport{}, syncKey, false, nil |
| 32 | } |
| 33 | s.homePluginSyncMu.Unlock() |
| 34 | } |
| 35 | report, errSync := homeplugins.SyncWithReport(ctx, cfg, s.pluginHost) |
| 36 | return report, syncKey, true, errSync |
| 37 | } |
| 38 | |
| 39 | func (s *Service) markHomePluginsSynced(syncKey string) { |
| 40 | if s == nil || strings.TrimSpace(syncKey) == "" { |