Skip to content

[FrameworkBundle][RateLimiter] default lock_factory to auto #60099

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

Merged
merged 1 commit into from
Apr 3, 2025

Conversation

kbond
Copy link
Member

@kbond kbond commented Mar 31, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues n/a
License MIT

Currently, when configuring a rate limiter and using the default configured lock factory (lock.factory), it fails if symfony/lock isn't installed. You have to explicitly set it to null if you want to configure rate limiters without the lock component.

This changes the default lock_factory to auto then, at compile time, sets it to lock.factory if symfony/lock is installed and null if not.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

So it basically makes symfony/lock optional without needing to set lock_factory: null

Seems like an easy win

@fabpot
Copy link
Member

fabpot commented Apr 3, 2025

Thank you @kbond.

@fabpot fabpot merged commit 59d8c63 into symfony:7.3 Apr 3, 2025
10 of 11 checks passed
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Apr 7, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[RateLimiter] default `lock_factory` to `auto`

Ref: symfony/symfony#60099
Closes #20854.

This is a small DX improvement so don't think it needs too much explanation.

Commits
-------

eb5f908 [RateLimiter] default `lock_factory` to `auto`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants