fix: add unbuffered python output in dev runner, cursor pattern in analytics
- dev_run.sh: add -u flag so log output is not buffered (real-time visibility) - analytics.py: use explicit cursor() with try/finally close instead of calling execute() directly on the connection (thread-safe cursor lifecycle) - .sops.yaml: add second age public key for local dev decryption access - content/__init__.py: whitespace-only formatting fix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
creation_rules:
|
||||
- path_regex: \.env\..+\.sops$
|
||||
age: age1f5002gj4s78jju45jd28kuejtcfhn5cdujz885fl7z2p9ym68pnsgky87a
|
||||
age: age1f5002gj4s78jju45jd28kuejtcfhn5cdujz885fl7z2p9ym68pnsgky87a,age1wjepykv3glvsrtegu25tevg7vyn3ngpl607u3yjc9ucay04s045s796msw
|
||||
|
||||
@@ -165,8 +165,8 @@ echo ""
|
||||
echo "Press Ctrl-C to stop all processes."
|
||||
echo ""
|
||||
|
||||
run_with_label "$COLOR_APP" "app " uv run python -m padelnomics.app
|
||||
run_with_label "$COLOR_WORKER" "worker" uv run python -m padelnomics.worker
|
||||
run_with_label "$COLOR_APP" "app " uv run python -u -m padelnomics.app
|
||||
run_with_label "$COLOR_WORKER" "worker" uv run python -u -m padelnomics.worker
|
||||
run_with_label "$COLOR_CSS" "css " make css-watch
|
||||
|
||||
wait
|
||||
|
||||
@@ -51,9 +51,13 @@ async def fetch_analytics(sql: str, params: list | None = None) -> list[dict[str
|
||||
return []
|
||||
|
||||
def _run() -> list[dict]:
|
||||
rel = _conn.execute(sql, params or [])
|
||||
cur = _conn.cursor()
|
||||
try:
|
||||
rel = cur.execute(sql, params or [])
|
||||
cols = [d[0] for d in rel.description]
|
||||
return [dict(zip(cols, row)) for row in rel.fetchall()]
|
||||
finally:
|
||||
cur.close()
|
||||
|
||||
try:
|
||||
return await asyncio.to_thread(_run)
|
||||
|
||||
@@ -474,7 +474,8 @@ async def generate_articles(
|
||||
md_dir.mkdir(parents=True, exist_ok=True)
|
||||
(md_dir / f"{article_slug}.md").write_text(body_md)
|
||||
|
||||
# Upsert article in SQLite — keyed by (url_path, language)
|
||||
# Upsert article — keyed by (url_path, language).
|
||||
# Single statement: no SELECT round-trip, no per-row commit.
|
||||
await db.execute(
|
||||
"""INSERT INTO articles
|
||||
(url_path, slug, title, meta_description, country, region,
|
||||
|
||||
Reference in New Issue
Block a user