Fix unbounded API queries causing worker timeouts #99
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user