Skip to content

fix(stats): reject non-positive bandwidth polling intervals [skip changelog] - #11464

Open
wangjingshuiku wants to merge 1 commit into
ipfs:masterfrom
wangjingshuiku:master
Open

wangjingshuiku wants to merge 1 commit into
ipfs:masterfrom
wangjingshuiku:master

Conversation

@wangjingshuiku

Copy link
Copy Markdown

Summary

  • Reject zero and negative polling intervals in ipfs stats bw.
  • Add CLI regression coverage for 0s and -1s.

Motivation

time.ParseDuration accepts non-positive durations. With --poll, passing --interval=0s or --interval=-1s makes time.After immediately ready, causing stats bw to repeatedly collect and emit bandwidth statistics without waiting.

The command now returns:

interval must be greater than zero

for non-positive intervals.

Testing

  • make build
  • go test ./test/cli -run '^TestStats$' -count=1 -v
  • go test ./core/commands -run '^$'
  • git diff --check

@wangjingshuiku
wangjingshuiku requested a review from a team as a code owner September 12, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant