Replaced working redis with version 2 alpha - rebuilt cache with drush - it threw
Error: Class "Drupal\redis\Client\PhpRedisFactory" not found in Drupal\Component\DependencyInjection\Container->createService() (line 261 of /var/www/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php
The website encountered an unexpected error. Try again later.
TypeError: RateLimit\RedisRateLimiter::__construct(): Argument #2 ($redis) must be of type Redis, Drupal\redis\Client\PhpRedis given, called in /var/www/public_html/modules/crawler_rate_limit/src/RateLimitBackendFactory.php on line 98 in RateLimit\RedisRateLimiter->__construct() (line 18 of vendor/nikolaposa/rate-limit/src/RedisRateLimiter.php).RateLimit\RedisRateLimiter->__construct() (Line: 98)Drupal\crawler_rate_limit\RateLimitBackendFactory->getRedis() (Line: 62)Drupal\crawler_rate_limit\RateLimitBackendFactory->get() (Line: 216)Drupal\crawler_rate_limit\RateLimitManager->limitReached() (Line: 270)Drupal\crawler_rate_limit\RateLimitManager->limit() (Line: 50)Drupal\crawler_rate_limit\CrawlerRateLimitMiddleware->handle() (Line: 61)Drupal\advban\AdvbanMiddleware->handle() (Line: 50)Drupal\ban\BanMiddleware->handle() (Line: 48)Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)Drupal\Core\DrupalKernel->handle() (Line: 19)
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | RateLimitBackendFactory.php_.patched.txt | 6.78 KB | johannesjvorstermans |
Issue fork crawler_rate_limit-3565789
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3565789-redis2-adapter
changes, plain diff MR !24
- 3565789-redis2-support
changes, plain diff MR !21
Comments
Comment #2
berdirYou are using another module that relies on redis, that needs to be updated: crawler_rate_limit. You need to report this there.
Comment #3
berdirMoving to that project.
Comment #4
johannesjvorstermans commentedAttached is a Patch
What the Patch Changes
Only the getRedis() method is modified (lines 95-108 in the original). Instead of passing $client directly to RedisRateLimiter, it now calls extractRawRedisClient($client) which:
If the client is already a raw \Redis or \Predis\ClientInterface (Redis 1.x), returns it as-is
If it's a Redis 2.x adapter, uses reflection to access the protected $redis property and returns the underlying native client
This works for both PhpRedis and Predis configurations. No other changes were made to the file.
Comment #5
ressaThanks @johannesjvorstermans, maybe you can create a GitLab Merge Request? https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...
Comment #8
vaish commentedThanks for the patch @johannesjvorstermans. I created a GitLab MR from your patch. Planning to make some tweaks to it before merging.
Comment #11
vaish commentedComment #13
vaish commentedMerged. Thanks everyone.