Fix unbounded API queries causing worker timeouts #99

Merged
cal merged 2 commits from bugfix/limit-caps into main 2026-04-01 22:44:40 +00:00
Showing only changes of commit 67e87a893a - Show all commits

View File

@ -93,13 +93,14 @@ async def get_fieldingstats(
)
all_stats = all_stats.where((BattingStat.week >= start) & (BattingStat.week <= end))
total_count = all_stats.count()
all_stats = all_stats.limit(limit)
if sort:
if sort == "newest":
all_stats = all_stats.order_by(-BattingStat.week, -BattingStat.game)
return_stats = {
"count": all_stats.count(),
"count": total_count,
"stats": [
{
"player": x.player_id