hub-monorepo icon indicating copy to clipboard operation
hub-monorepo copied to clipboard

feat: create time-bucketed rate limits based on message timestamp

Open CassOnMars opened this issue 6 months ago • 2 comments

Why is this change needed?

Rate limiting hits odd edge cases from synchronization, this alters rate limiters based on fids to bucket into specialized rate limits per message timestamps

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review

  • [x] PR title adheres to the conventional commits standard
  • [x] PR has a changeset
  • [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore)
  • [ ] PR includes documentation if necessary.

PR-Codex overview

This PR introduces time-bucketed rate limits based on message timestamp for better message handling.

Detailed summary

  • Added getRateLimiterForTotalMessagesByTimeBucket function
  • Updated rate limiting logic in tests and engine
  • Defined MAX_MESSAGES_PER_FID_IN_MINUTE constant
  • Modified rate limiter map to use duration and total messages as keys

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

CassOnMars avatar Aug 08 '24 02:08 CassOnMars