MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / Run

Method Run

internal/nodeagent/usage.go:85–97  ·  view source on GitHub ↗

Run 阻塞循环 push usage,直到 ctx done。

(ctx context.Context)

Source from the content-addressed store, hash-verified

83
84// Run 阻塞循环 push usage,直到 ctx done。
85func (p *UsagePusher) Run(ctx context.Context) error {
86 t := time.NewTicker(p.interval)
87 defer t.Stop()
88
89 for {
90 select {
91 case <-ctx.Done():
92 return ctx.Err()
93 case <-t.C:
94 p.tick(ctx)
95 }
96 }
97}
98
99// Tick 执行单次推送循环。仅供测试 / 集成验证使用:生产路径走 Run。
100func (p *UsagePusher) Tick(ctx context.Context) { p.tick(ctx) }

Callers 2

RunFunction · 0.95

Calls 4

tickMethod · 0.95
StopMethod · 0.65
DoneMethod · 0.65
ErrMethod · 0.65

Tested by 1