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

Function NewUsagePusher

internal/nodeagent/usage.go:47–57  ·  view source on GitHub ↗

NewUsagePusher 构造一个 pusher。interval==0 时取默认 60s。

(api UsageSnapshotProvider, interval time.Duration)

Source from the content-addressed store, hash-verified

45
46// NewUsagePusher 构造一个 pusher。interval==0 时取默认 60s。
47func NewUsagePusher(api UsageSnapshotProvider, interval time.Duration) *UsagePusher {
48 if interval <= 0 {
49 interval = 60 * time.Second
50 }
51 return &UsagePusher{
52 api: api,
53 interval: interval,
54 logger: slog.Default(),
55 ackWait: interval, // 默认 ack 超时 = 一个 interval
56 }
57}
58
59// SetAckTimeout 自定义等待 ack 的超时;<=0 时复用 interval。
60func (p *UsagePusher) SetAckTimeout(d time.Duration) {

Calls

no outgoing calls