Skip to content

Simplify try_acquire method#245

Open
JoaquinPolonuer wants to merge 3 commits into
mainfrom
refactor_try_acquire
Open

Simplify try_acquire method#245
JoaquinPolonuer wants to merge 3 commits into
mainfrom
refactor_try_acquire

Conversation

@JoaquinPolonuer

Copy link
Copy Markdown

No description provided.

@JoaquinPolonuer JoaquinPolonuer changed the title Refactor try acquire Simplify try_acquire method Feb 24, 2025
@JoaquinPolonuer

JoaquinPolonuer commented Feb 24, 2025

Copy link
Copy Markdown
Author

Moved this here from llmclient library. Will implement tests to check if try_acquire works as expected.

@jamesbraza jamesbraza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work, LGTM

with pytest.raises(TimeoutError):
await GLOBAL_LIMITER.try_acquire(("get", "test"), acquire_timeout=2)

# Then we pass an impossible limit, but with a timeour high enough to succeed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Then we pass an impossible limit, but with a timeour high enough to succeed
# Then we pass an impossible limit, but with a timeout high enough to succeed

Re-reading this, I just noticed a typo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For fun I made codespell-project/codespell#3656 for this, lol

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