From 54c98acc253eef8bd848ba9658b86f442fa06376 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 12 Jun 2026 00:20:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20list=5Ftasks=E7=94=A8sqlExe=E6=9B=BF?= =?UTF-8?q?=E4=BB=A3sort=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/storage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pipeline_service/storage.py b/pipeline_service/storage.py index 0dc4c8b..56e2c4f 100644 --- a/pipeline_service/storage.py +++ b/pipeline_service/storage.py @@ -206,10 +206,12 @@ async def list_tasks(tenant_id: str, pipeline_id: str = None, limit: int = 100) """List tasks for a tenant.""" db, dbname = _get_db() async with db.sqlorContext(dbname) as sor: - filters = {'tenant_id': tenant_id} if pipeline_id: - filters['pipeline_id'] = pipeline_id - recs = await sor.R('pipeline_tasks', filters, sort='created_at desc') + sql = "SELECT * FROM pipeline_tasks WHERE tenant_id=${tenant_id}$ AND pipeline_id=${pipeline_id}$ ORDER BY created_at DESC" + recs = await sor.sqlExe(sql, {'tenant_id': tenant_id, 'pipeline_id': pipeline_id}) + else: + sql = "SELECT * FROM pipeline_tasks WHERE tenant_id=${tenant_id}$ ORDER BY created_at DESC" + recs = await sor.sqlExe(sql, {'tenant_id': tenant_id}) result = [] for rec in (recs or [])[:limit]: if hasattr(rec, '__dict__'):