-
Notifications
You must be signed in to change notification settings - Fork 644
Clear APIResource cache on undeploy event #13071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis pull request introduces a new method to determine if API resource validation is enabled and adjusts the cache management logic in two components. In the gateway deployer, a method Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GatewayDeployer as InMemoryAPIDeployer
participant Config as APIManagerConfiguration
participant CacheService as CacheInvalidationServiceImpl
Client->>GatewayDeployer: Call unDeployAPI(gatewayEvent)
GatewayDeployer->>GatewayDeployer: isAPIResourceValidationEnabled()
GatewayDeployer->>Config: Retrieve validation configuration
Config-->>GatewayDeployer: Return true/false
alt Validation Enabled
GatewayDeployer->>CacheService: invalidateResourceCache(context, version, tenantDomain, [])
else Validation Disabled
Note right of GatewayDeployer: Skip cache invalidation
end
GatewayDeployer-->>Client: API undeployment complete
sequenceDiagram
participant EventSource as API Revision Event
participant DataStore as SubscriptionDataStoreImpl
participant API as API Object
EventSource->>DataStore: Trigger addOrUpdateAPIRevisionWithUrlTemplates(event)
DataStore->>DataStore: Check if event type is REMOVE_API_FROM_GATEWAY
alt Not REMOVE_API_FROM_GATEWAY
DataStore->>DataStore: Load new API and update API map
DataStore->>API: If API is valid, then...
API-->>DataStore: API loaded
DataStore->>DataStore: clearResourceCache(api, tenantDomain)
else REMOVE_API_FROM_GATEWAY
Note right of DataStore: Skip API map update and cache clear
end
Assessment against linked issues
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code Definitions (1)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Improvements to API resource cache invalidation:
Invalidating the resource cache when undeploying an API, and ensuring the resource cache is cleared when creating API revisions.
Fix: wso2/api-manager#3843