Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: speedometer (ratelimit for i/o) #11

Merged
merged 14 commits into from
Jan 20, 2024
Merged

Feat: speedometer (ratelimit for i/o) #11

merged 14 commits into from
Jan 20, 2024

Conversation

yunginnanet
Copy link
Owner

@yunginnanet yunginnanet commented Jan 8, 2024

  • Speedometer is an io.Writer wrapper that can limit the rate at which data is written to the underlying target.
  • It can be given a capacity, which will cause it to return an error if the capacity is exceeded.
  • It can also be given a speed limit, causing slow downs of data written to the underlying writer if the speed limit is exceeded.
  • It is safe for concurrent use, but writers will block when slowed down.

(From: #11 (comment))

Copy link

github-actions bot commented Jan 8, 2024

GPT summary of 99403c3:

Copy link

codecov bot commented Jan 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4413fdb) 100.00% compared to head (c1ed133) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main       #11    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            3         4     +1     
  Lines          137       249   +112     
==========================================
+ Hits           137       249   +112     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
Repository owner deleted a comment from github-actions bot Jan 8, 2024
@yunginnanet yunginnanet added the enhancement New feature or request label Jan 8, 2024
Copy link

@ginger51011 ginger51011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all I think this is great! I am not sure of the sync logic, it's hard enough in a language you know well to wrap your head around.

I hope my comments are somewhat useful, and not completely uncalled for.

.github/workflows/go.yml Show resolved Hide resolved
speedometer/speedometer.go Show resolved Hide resolved
speedometer/speedometer.go Outdated Show resolved Hide resolved
speedometer/speedometer.go Show resolved Hide resolved
speedometer/speedometer.go Outdated Show resolved Hide resolved
speedometer/speedometer.go Show resolved Hide resolved
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
Repository owner deleted a comment from github-actions bot Jan 20, 2024
@yunginnanet
Copy link
Owner Author

yunginnanet commented Jan 20, 2024

All in all I think this is great! I am not sure of the sync logic, it's hard enough in a language you know well to wrap your head around.

I hope my comments are somewhat useful, and not completely uncalled for.

definitely helpful! helped me spot some unused code in there that would have even costed us a few atomic CPU operations that effectively did nothing but waste our time. I appreciate it!

as for the synchronization, we can only hope that my unit tests (100% coverage at least) are robust enough to make sure i'm not a total dumbass :^)

@yunginnanet yunginnanet merged commit 4a3e80a into main Jan 20, 2024
6 checks passed
@yunginnanet yunginnanet deleted the speedo branch January 20, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants