Cache built-in game parsing to avoid recomputation per request

This commit is contained in:
Michael Pilosov 2026-04-06 14:25:16 -06:00
parent 0a7cdc0f15
commit 46955f0644
3 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[project]
name = "chess-pressure"
version = "0.1.1"
version = "0.1.2"
description = "Chess pressure heatmap visualization"
readme = "README.md"
requires-python = ">=3.11"

View File

@ -2,6 +2,7 @@
from __future__ import annotations
from functools import lru_cache
from pathlib import Path
import uvicorn
@ -39,6 +40,7 @@ def list_games():
@app.get("/api/games/{game_id}")
@lru_cache(maxsize=16)
def load_game(game_id: str):
pgn = get_game_pgn(game_id)
if pgn is None:

2
uv.lock generated
View File

@ -41,7 +41,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/93/09/7d04d7581ae3bb8b5
[[package]]
name = "chess-pressure"
version = "0.1.1"
version = "0.1.2"
source = { editable = "." }
dependencies = [
{ name = "fastapi" },