fix: 修复大规模数据性能与流式状态清理
This commit is contained in:
@@ -143,7 +143,7 @@ func (r *SQLiteUsageRepository) QueryUsage(ctx context.Context, input collection
|
||||
}
|
||||
where, args := usageWhere(query)
|
||||
var total int64
|
||||
if err := r.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM request_detail_index d WHERE `+where, args...).Scan(&total); err != nil {
|
||||
if err := r.readDB.QueryRowContext(ctx, `SELECT COUNT(*) FROM request_detail_index d WHERE `+where, args...).Scan(&total); err != nil {
|
||||
return collection.UsagePage{}, fmt.Errorf("统计请求明细: %w", err)
|
||||
}
|
||||
totalPages := 0
|
||||
@@ -179,7 +179,7 @@ func (r *SQLiteUsageRepository) QueryUsage(ctx context.Context, input collection
|
||||
} else {
|
||||
statement += " LIMIT ? OFFSET ?"
|
||||
}
|
||||
rows, err := r.db.QueryContext(ctx, statement, limitArgs...)
|
||||
rows, err := r.readDB.QueryContext(ctx, statement, limitArgs...)
|
||||
if err != nil {
|
||||
return collection.UsagePage{}, fmt.Errorf("查询请求明细: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user