spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

fix: prevent duplicate cache error handler execution in FeignCachingInvocationHandlerFactory

Open yashdotdev13 opened this issue 8 months ago • 0 comments

This PR fixes an issue where cache error handling is executed twice when using @Cacheable on Feign clients.

Problem

Caching was being applied twice:

  • Once by Spring Cache (CacheInterceptor)
  • Once by FeignCachingInvocationHandlerFactory

This caused duplicate execution of cache error handling methods.

Solution

Added a ThreadLocal guard to prevent nested cache invocation inside FeignCachingInvocationHandlerFactory.

Result

  • Cache interception is executed only once
  • Prevents duplicate error handler execution

Closes #681

yashdotdev13 avatar Apr 02 '26 07:04 yashdotdev13