Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: Cache AppQueueManager.is_stopped() to reduce unnecessary Redis … (#26778)
Ponderec6cafd7aacc
diff --git a/api/core/app/apps/base_app_queue_manager.py b/api/core/app/apps/base_app_queue_manager.pyindex 4b246a53d31..074555e31b1 100644--- a/api/core/app/apps/base_app_queue_manager.py+++ b/api/core/app/apps/base_app_queue_manager.py@@ -1,10 +1,12 @@import loggingimport queue+import threadingimport timefrom abc import abstractmethodfrom enum import IntEnum, autofrom typing import Any+from cachetools import TTLCache, cachedmethodfrom redis.exceptions import RedisErrorfrom sqlalchemy.orm import DeclarativeMeta@@ -45,6 +47,8 @@ class AppQueueManager:q: queue.Queue[WorkflowQueueMessage | MessageQueueMessage | None] = queue.Queue()self._q = q+ self._stopped_cache: TTLCache[tuple, bool] = TTLCache(maxsize=1, ttl=1)+ self._cache_lock = threading.Lock()def listen(self):"""@@ -157,6 +161,7 @@ class AppQueueManager:stopped_cache_key = cls._generate_stopped_cache_key(task_id)redis_client.setex(stopped_cache_key, 600, 1)+ @cachedmethod(lambda self: self._stopped_cache, lock=lambda self: self._cache_lock)def _is_stopped(self) -> bool:"""Check if task is stopped