I've filed a task in phabricator to follow up in case there's any surprises
with the proposed fix. :) https://phabricator.wikimedia.org/T162077

-- brion

On Mon, Apr 3, 2017 at 11:52 AM, Brion Vibber <[email protected]> wrote:

> On Mon, Apr 3, 2017 at 12:56 AM, Nischay Nahata <[email protected]>
> wrote:
>
>>
>> I have been trying to add certain rate limiting actions for my extension's
>> API and noticed that it doesn't work with $wgMainCacheType set to
>> CACHE_NONE
>>
>> This is because  User::pingLimiter()
>> uses ObjectCache::getLocalClusterInstance() to store the current rate
>> limit
>> counts.
>>
>> Is this the expected behavior? Looks pretty deceitful to me
>> as $wgMainCacheType is assumed to define the cache type but is actually
>> disabling a core functionality like rate limiting and maybe few others?
>>
>
> I'm pretty sure this one's my fault -- at the time it was added we didn't
> expect the rate limit feature to be used in a minimal configuration without
> an object cache configured, and it ended up being kind of kept that way
> through the years.
>
> I would recommend probably changing this:
> $cache = ObjectCache::getLocalClusterInstance();
> to:
> $cache = ObjectCache::getInstance( CACHE_ANYTHING );
>
> That should set the rate limiter to use the database-backed cache when
> $wgMainCacheType is set to CACHE_NONE, and will use the main cache when
> it's not set off.
>
> -- brion
>
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to