Skip to content

armgit / dify

Public Imported from GitHub
0

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.

improve message clean logic (#11487)

Jyong00ac7edeb363
diff --git a/api/schedule/clean_messages.py b/api/schedule/clean_messages.py
index 72ee2a8901a..97e5c77e953 100644
--- a/api/schedule/clean_messages.py
+++ b/api/schedule/clean_messages.py
@@ -36,14 +36,16 @@ def clean_messages():
db.session.query(Message)
.filter(Message.created_at < plan_sandbox_clean_message_day)
.order_by(Message.created_at.desc())
- .paginate(page=page, per_page=100)
+ .limit(100)
+ .all()
)
except NotFound:
break
- if messages.items is None or len(messages.items) == 0:
+ if not messages:
break
- for message in messages.items:
+ for message in messages:
+ plan_sandbox_clean_message_day = message.created_at
app = App.query.filter_by(id=message.app_id).first()
features_cache_key = f"features:{app.tenant_id}"
plan_cache = redis_client.get(features_cache_key)