dmsolr opened a new pull request, #7029: URL: https://github.com/apache/shenyu/pull/7029
Fixes #6645 ### Root cause In `RedisRateLimiter.isAllowed`, `onErrorResume` absorbed every Redis error into a normal `Flux.just(1L, -1L)` emission, so the trailing `.doOnError(...)` (which logged the error and invoked the rate limiter algorithm's `callback`, e.g. cleanup of optimistically-written keys in `ConcurrentRateLimiterAlgorithm`) was unreachable dead code. On a Redis outage, every request was silently fail-opened with no log signal and no cleanup callback. ### Fix Move the algorithm callback invocation and error logging into the `onErrorResume` lambda itself, so they actually execute when a Redis error occurs. Removed the now-dead `.doOnError(...)`. ### Testing - Added `allowedThrowableInvokesAlgorithmCallbackTest` in `RedisRateLimiterTest`, using the `concurrent` algorithm, asserting the algorithm's error callback (Redis zset cleanup) is invoked when the Redis call errors. This test fails against the old code and passes after the fix. - `./mvnw -pl shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-ratelimiter -am test`: checkstyle 0 violations, full reactor build success, all tests pass (including 8/8 in `RedisRateLimiterTest`). - [x] You have read the contribution guidelines. - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true` (module-scoped). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
