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

Use tokio's testing feature to advance time of rate limitter #168

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

kannapoix
Copy link
Contributor

@kannapoix kannapoix commented Sep 3, 2024

This closes #56, but with not the way the issue suggested.

Use tokio::time::advance instead of manually updating rate_limiter.last_update.
I removed a mock because I don't see any necessity of it, but maybe overlooked something.

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (1cf2906) to head (adac81a).
Report is 4 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #168   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           1       1           
  Lines         126     126           
======================================
  Misses        126     126           

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

@kannapoix kannapoix marked this pull request as ready for review October 8, 2024 00:58
@dunxen
Copy link
Collaborator

dunxen commented Oct 9, 2024

Thanks!

This looks like a simple solution since we already have tokio as a dependency and this is just for testing. The less test utils we have to manually write, the better (in my opinion) so long as the dependency is justified (which it is in this case!)

I'll have a proper review of this today as I'm not 100% familiar with the util. Just catching up on things.

Copy link
Collaborator

@dunxen dunxen left a comment

Choose a reason for hiding this comment

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

Apologies for letting this slip!

I'm happy to have this extra dependency for testing. It has pretty simple usage too!

Thanks 🙏

@dunxen dunxen merged commit 190e782 into lndk-org:master Nov 8, 2024
11 checks passed
@kannapoix kannapoix deleted the improve-rate-limit-testing branch November 18, 2024 12:06
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.

Task: Improve Rate Limiter Handling of Time
2 participants