mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
perf(usage): user-me usage 查询避免全量加载,默认限制 7 天范围
- UsageAuditListQuery 新增 limit 字段,支持在 SQL 层 LIMIT - user-me usage 端点无时间范围时默认查最近 7 天 - active usage 端点无 ids 过滤时限制查最近 1 小时 - InMemory 实现同步支持 limit truncate
This commit is contained in:
@@ -26,6 +26,7 @@ pub(crate) async fn list_usage_for_range(
|
||||
provider_name: filters.provider_name.clone(),
|
||||
model: filters.model.clone(),
|
||||
statuses: None,
|
||||
limit: None,
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -46,6 +47,7 @@ pub(crate) async fn list_usage_for_optional_range(
|
||||
provider_name: filters.provider_name.clone(),
|
||||
model: filters.model.clone(),
|
||||
statuses: None,
|
||||
limit: None,
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ pub(in super::super) async fn list_recent_completed_usage_for_cache_affinity(
|
||||
provider_name: None,
|
||||
model: None,
|
||||
statuses: None,
|
||||
limit: None,
|
||||
})
|
||||
.await?;
|
||||
items.retain(|item| item.status == "completed");
|
||||
|
||||
Reference in New Issue
Block a user