-
Notifications
You must be signed in to change notification settings - Fork 375
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(examples): Implement p/demo/dequeue & p/demo/ratelimiter #2170
base: master
Are you sure you want to change the base?
Conversation
@moul i have just implemented queue structure, please take a look ! |
// PushFront adds an element to the front of the queue. | ||
// Returns an error if the queue is full. | ||
func (q *Queue) PushFront(value interface{}) error { | ||
if q.begin-1 == q.end { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With q.begin
(uint) set to 0 by default, you may encounter an issue here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this case, q.begin
will equal max.Uint64
and does not cause any other runtime errors
You are adding general-purpose libraries, which is good. However, it's challenging to review without a real usage example. Could you create dapps using your new libraries or provide more actionable examples? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2170 +/- ##
==========================================
- Coverage 60.24% 60.21% -0.04%
==========================================
Files 562 562
Lines 75031 75031
==========================================
- Hits 45200 45177 -23
- Misses 26458 26479 +21
- Partials 3373 3375 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
From issue : #2119
Using
Dequeue
in therate_limiter
package optimizes action history management by enabling efficient additions and removals at both ends of the queue. This approach ensures constant-time operations and better performance for rate-limiting mechanismsContributors' checklist...
BREAKING CHANGE: xxx
message was included in the description