dify/api/services
Harry 70d0d46678 fix(api): remove tool provider list cache to fix cache inconsistency
This commit removes the Redis caching mechanism for tool provider list
API that was introduced in #29101.

## Problems with the current caching approach

1. **Cache inconsistency**: After CRUD operations on tool providers,
   cached data may not be properly invalidated, causing stale data.

2. **Race conditions**: Cache invalidation timing issues - invalidating
   inside Redis locks caused timeouts (#30150), moving outside causes
   race conditions.

3. **Hard to maintain**: Manual cache invalidation scattered across
   multiple service files is error-prone and difficult to maintain.

4. **User-facing symptoms**:
   - Newly created tools not appearing in the list
   - Deleted tools still showing up
   - Updated tool configurations not reflecting immediately
   - MCP provider auth state not updating correctly

## Changes

- Remove `ToolProviderListCache` class and its usage
- Remove cache invalidation calls from all service files
- Remove related test mocks
- Keep the code optimizations from #29101 (session management, batch processing)

Fixes #30322

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 16:32:42 +08:00
..
auth fix: fix firecrawl url concat (#30008) 2025-12-24 09:40:32 +08:00
document_indexing_proxy feat: enable tenant isolation on duplicate document indexing tasks (#29080) 2025-12-08 17:54:57 +08:00
enterprise fix: use query param for delete method (#30206) 2025-12-26 00:34:35 -08:00
entities fix(api): resolve errors when setting visibility to partial members (#29830) 2025-12-18 16:56:24 +08:00
errors fix: consolidate duplicate InvokeRateLimitError definitions (#30229) 2025-12-28 03:03:42 +09:00
plugin fix(api): fix credential type handling and rebuild subscription transaction safety (#30242) 2025-12-28 20:29:35 +08:00
rag_pipeline feat: Add "type" field to PipelineRecommendedPlugin model; Add query param "type" to recommended-plugins api. (#29736) 2025-12-17 11:26:08 +08:00
recommend_app change all to httpx (#26119) 2025-10-10 23:41:16 +08:00
tools fix(api): remove tool provider list cache to fix cache inconsistency 2025-12-29 16:32:42 +08:00
trigger fix(api): fix credential type handling and rebuild subscription transaction safety (#30242) 2025-12-28 20:29:35 +08:00
workflow feat: trigger billing (#28335) 2025-11-20 10:15:23 +08:00
__init__.py chore(api/services): apply ruff reformatting (#7599) 2024-08-26 13:43:57 +08:00
account_service.py refactor: port reqparse to Pydantic model (#28949) 2025-12-05 13:05:53 +09:00
advanced_prompt_template_service.py chore: adopt StrEnum and auto() for some string-typed enums (#25129) 2025-09-12 21:14:26 +08:00
agent_service.py use deco to avoid current_user (#26077) 2025-10-16 15:45:51 +09:00
annotation_service.py fix: csv injection in annotations export (#29462) 2025-12-15 17:14:05 +08:00
api_based_extension_service.py remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
app_dsl_service.py fix: YAML URL import rewrite for GitHub attachments (#30003) 2025-12-23 19:14:39 +09:00
app_generate_service.py fix: consolidate duplicate InvokeRateLimitError definitions (#30229) 2025-12-28 03:03:42 +09:00
app_model_config_service.py remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
app_service.py feat(api): Implement EventManager error logging and add coverage (#29204) 2025-12-08 09:40:40 +08:00
app_task_service.py fix: ensure advanced-chat workflows stop correctly (#27803) 2025-11-25 20:09:03 +08:00
async_workflow_service.py fix: consolidate duplicate InvokeRateLimitError definitions (#30229) 2025-12-28 03:03:42 +09:00
attachment_service.py Feat/support multimodal embedding (#29115) 2025-12-09 14:41:46 +08:00
audio_service.py fix: remove unnecessary Flask context preservation to avoid circular import in audio service (#27380) 2025-10-24 10:41:14 +08:00
billing_service.py feat: add billing subscription plan api (#29829) 2025-12-18 13:11:47 +08:00
clear_free_plan_tenant_expired_logs.py refactor: replace hardcoded user plan strings with CloudPlan enum (#27675) 2025-11-03 11:51:09 +08:00
code_based_extension_service.py remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
conversation_service.py feat: support var filer in conversation service (#29245) 2025-12-22 21:48:11 +08:00
dataset_service.py feat: make the SegmentService.get_segments sort stable (#30152) 2025-12-25 15:53:38 +08:00
datasource_provider_service.py chore: update the error message (#29325) 2025-12-09 15:29:04 +08:00
end_user_service.py fix: allow API to access conversations created before upgrade to 1.10.0 (#28462) 2025-11-21 10:34:55 +08:00
external_knowledge_service.py chore: not slient call external service error (#29290) 2025-12-09 10:25:33 +08:00
feature_service.py feat: trigger billing (#28335) 2025-11-20 10:15:23 +08:00
feedback_service.py test: add comprehensive unit tests for FeedbackService (#28771) 2025-11-28 11:33:56 +08:00
file_service.py Feat/support multimodal embedding (#29115) 2025-12-09 14:41:46 +08:00
hit_testing_service.py fix: hit-test failed when attachment id is not exist (#29563) 2025-12-12 13:45:00 +08:00
knowledge_service.py rm type ignore (#25715) 2025-10-21 11:26:58 +08:00
message_service.py more typed orm (#28577) 2025-11-24 21:01:46 +08:00
metadata_service.py feat: Implement partial update for document metadata, allowing merging of new values with existing ones. (#28390) 2025-11-21 12:58:20 +08:00
model_load_balancing_service.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
model_provider_service.py fix: fix custom model credentials display as plaintext (#29425) 2025-12-11 09:48:45 +08:00
oauth_server.py use deco to avoid current_user (#26077) 2025-10-16 15:45:51 +09:00
operation_service.py more httpx (#25651) 2025-09-22 23:07:09 +08:00
ops_service.py feat: MLflow tracing (#26093) 2025-11-22 13:53:58 +08:00
recommended_app_service.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
saved_message_service.py use deco to avoid current_user (#26077) 2025-10-16 15:45:51 +09:00
tag_service.py more typed orm (#28577) 2025-11-24 21:01:46 +08:00
variable_truncator.py feat: _truncate_json_primitives support file (#29760) 2025-12-17 08:10:43 +09:00
vector_service.py Feat/support multimodal embedding (#29115) 2025-12-09 14:41:46 +08:00
web_conversation_service.py use deco to avoid current_user (#26077) 2025-10-16 15:45:51 +09:00
webapp_auth_service.py refactor: replace localStorage with HTTP-only cookies for auth tokens (#24365) 2025-10-19 21:29:04 +08:00
website_service.py refactor: Update Firecrawl to use v2 API (#24734) 2025-10-15 10:48:54 +08:00
workflow_app_service.py feat: introduce trigger functionality (#27644) 2025-11-12 17:59:37 +08:00
workflow_draft_variable_service.py feat:mysql adaptation for metadb (#28188) 2025-11-20 09:44:39 +08:00
workflow_run_service.py feat(api): Introduce workflow pause state management (#27298) 2025-10-30 14:41:09 +08:00
workflow_service.py Enhanced GraphEngine Pause Handling (#28196) 2025-11-26 19:59:34 +08:00
workspace_service.py Fix basedpyright type errors (#25435) 2025-09-10 01:54:26 +08:00