Skip to content

Conversation

@clipperhouse
Copy link
Owner

@clipperhouse clipperhouse commented Aug 23, 2025

bucketMap will currently grow unbounded. This PR implements a GC to remove no-longer-valuable buckets.

A bucket is no longer valuable when it is full due to the passage of time. A non-existent bucket is semantically equivalent to a full bucket; we create buckets full.

  • Add isFull method to bucket, which tests that its time is before or equal to now - limit.period.
  • gc method on bucketMap. Loop through all keys (buckets), delete if isFull
  • Add public methods Limiter[s].GC and Clear

A design decision here is not to run GC on the user’s behalf. We offer the primitive, and the user can choose timing.

@clipperhouse clipperhouse force-pushed the clipperhouse/gc branch 4 times, most recently from e39fe19 to 6d292c3 Compare August 23, 2025 16:11
@clipperhouse
Copy link
Owner Author

cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


Bugbot free trial expires on August 27, 2025
Learn more in the Cursor dashboard.

@clipperhouse clipperhouse requested a review from Copilot August 24, 2025 12:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@clipperhouse clipperhouse merged commit 8156bba into main Aug 24, 2025
10 checks passed
@clipperhouse clipperhouse deleted the clipperhouse/gc branch August 24, 2025 13:35
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.

2 participants