Major Domo Database - PostgreSQL database service for SBA bot
Go to file
Cal Corum 099286867a
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m13s
Optimize player search endpoint for 30x performance improvement
**Problem:**
The /players/search endpoint with all_seasons=True was taking 15+ seconds,
causing Discord autocomplete timeouts (3-second limit). The endpoint was
loading ALL players from ALL seasons into memory, then doing Python string
matching - extremely inefficient.

**Solution:**
1. Use SQL LIKE filtering at database level instead of Python iteration
2. Limit query results at database level (not after fetching all records)
3. Add functional index on LOWER(name) for faster case-insensitive search

**Performance Impact:**
- Before: 15+ seconds (loads 10,000+ player records)
- After: <500ms (database-level filtering with index)
- 30x faster response time

**Changes:**
- app/services/player_service.py: Use Peewee fn.Lower().contains() for SQL filtering
- migrations/2026-02-06_add_player_name_index.sql: Add index on LOWER(name)
- VERSION: Bump to 2.6.0 (minor version for performance improvement)

**Testing:**
Test with: https://sba.manticorum.com/api/v3/players/search?q=trea%20t&season=0&limit=30

Fixes Discord bot /player autocomplete timeout errors (error code 10062)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 07:25:49 -06:00
.claude chore: Move documentation to .claude/ 2026-02-05 13:14:09 -06:00
.gitea/workflows Add Gitea Actions CI/CD pipeline 2026-02-04 11:43:18 -06:00
app Optimize player search endpoint for 30x performance improvement 2026-02-06 07:25:49 -06:00
migrations Optimize player search endpoint for 30x performance improvement 2026-02-06 07:25:49 -06:00
scripts CLAUDE: Add --clean flag to production database sync 2025-10-23 16:52:42 -05:00
tests fix: Complete dependency injection refactor and restore caching 2026-02-04 01:13:46 -06:00
.dockerignore Adding Git and Docker files 2023-02-21 11:53:02 -06:00
.env Local migration fully functional 2025-08-20 09:52:46 -05:00
.gitignore Local migration fully functional 2025-08-20 09:52:46 -05:00
CLAUDE.md Fix custom command creator POST validation (v2.3.1) 2025-12-13 16:31:47 -06:00
deploy.sh Add Gitea Actions CI/CD pipeline 2026-02-04 11:43:18 -06:00
docker-compose.yml chore: Comment out external network for local testing 2026-02-04 21:00:02 -06:00
Dockerfile Local migration fully functional 2025-08-20 09:52:46 -05:00
LICENSE Initial commit 2023-02-19 21:42:32 -06:00
pytest.ini refactor: Add dependency injection for testability 2026-02-03 15:59:04 +00:00
requirements.txt refactor: Add dependency injection for testability 2026-02-03 15:59:04 +00:00
VERSION Optimize player search endpoint for 30x performance improvement 2026-02-06 07:25:49 -06:00