tenancy icon indicating copy to clipboard operation
tenancy copied to clipboard

RateLimiter stored globally in Redis

Open Lucisu opened this issue 1 year ago • 3 comments

Bug description

When using Laravel's RateLimiter, the attempts are stored globally instead of separately per tenant.

Steps to reproduce

Execute in the first tenant:

RateLimiter::attempt( 'key', 100, function () { return true; }, 60*60 );

In the second tenant, you can see that the remaining attempts is 99 instead of 100:

RateLimiter::remaining( 'key', 100 );

Expected behavior

Like the Cache calls, I think that RateLimiter calls should be separated by the tenant.

Laravel version

11.9

stancl/tenancy version

3.8

Lucisu avatar Aug 08 '24 17:08 Lucisu

What bootstrappers do you have enabled?

stancl avatar Aug 08 '24 17:08 stancl

The default ones from 3.8, nothing changed

Lucisu avatar Aug 08 '24 17:08 Lucisu

Does enabling the RedisTenancyBootstrapper fix this?

stancl avatar Aug 09 '24 13:08 stancl

Closing for inactivity

stancl avatar Jan 11 '25 13:01 stancl