Skip to content

fix: don't query database when flush is called concurrently#2202

Merged
abelanger5 merged 1 commit into
mainfrom
belanger/rl-optimization-3
Aug 26, 2025
Merged

fix: don't query database when flush is called concurrently#2202
abelanger5 merged 1 commit into
mainfrom
belanger/rl-optimization-3

Conversation

@abelanger5
Copy link
Copy Markdown
Contributor

Description

When there are many calls to *RateLimiter.use concurrently, we can still query the database more than the desired frequency because we call flushToDatabase before we've updated the nextRefillAt. This properly serializes the flush calls.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
hatchet-docs Ready Ready Preview Comment Aug 26, 2025 2:16pm
hatchet-v0-docs Ready Ready Preview Comment Aug 26, 2025 2:16pm

@abelanger5 abelanger5 merged commit acf7215 into main Aug 26, 2025
57 of 65 checks passed
@abelanger5 abelanger5 deleted the belanger/rl-optimization-3 branch August 26, 2025 15:00
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