MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / reportHomePluginStatus

Method reportHomePluginStatus

sdk/cliproxy/home_plugins.go:48–76  ·  view source on GitHub ↗
(ctx context.Context, cfg *config.Config, report homeplugins.SyncReport)

Source from the content-addressed store, hash-verified

46}
47
48func (s *Service) reportHomePluginStatus(ctx context.Context, cfg *config.Config, report homeplugins.SyncReport) {
49 if s == nil || cfg == nil {
50 return
51 }
52 if s.homeClient == nil {
53 log.Warn("failed to report home plugin status: home client is unavailable")
54 return
55 }
56 nodeID := strings.TrimSpace(cfg.Home.NodeID)
57 if nodeID == "" {
58 log.Warn("failed to report home plugin status: node id is empty")
59 return
60 }
61 report.NodeID = nodeID
62 report.UpdatedAt = time.Now().UTC()
63 raw, errMarshal := json.Marshal(report)
64 if errMarshal != nil {
65 log.Warnf("failed to marshal home plugin status: %v", errMarshal)
66 return
67 }
68 if ctx == nil {
69 ctx = context.Background()
70 }
71 reportCtx, cancel := context.WithTimeout(ctx, homePluginStatusReportTimeout)
72 defer cancel()
73 if errReport := s.homeClient.RPushPluginStatus(reportCtx, raw); errReport != nil {
74 log.Warnf("failed to report home plugin status: %v", errReport)
75 }
76}
77
78func (s *Service) processHomePluginTasks(ctx context.Context, cfg *config.Config) {
79 if s == nil || cfg == nil || !cfg.Home.Enabled || s.homeClient == nil {

Callers 2

Calls 1

RPushPluginStatusMethod · 0.65

Tested by

no test coverage detected