log fixes

This commit is contained in:
Gamosoft 2026-06-30 16:52:22 +02:00
parent f42901b1d8
commit 12ed9bd3e9
3 changed files with 4 additions and 10 deletions

View File

@ -19,12 +19,12 @@ import aiofiles
from datetime import datetime from datetime import datetime
import bcrypt import bcrypt
import secrets import secrets
logger = logging.getLogger("uvicorn.error")
from slowapi import Limiter, _rate_limit_exceeded_handler from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.util import get_remote_address from slowapi.util import get_remote_address
from slowapi.errors import RateLimitExceeded from slowapi.errors import RateLimitExceeded
logger = logging.getLogger("uvicorn.error")
from .utils import ( from .utils import (
scan_notes_fast_walk, scan_notes_fast_walk,
ensure_index_built, ensure_index_built,
@ -1829,9 +1829,8 @@ app.include_router(pages_router)
# ============================================================================ # ============================================================================
# Startup warmup # Startup warmup
# ============================================================================ # ============================================================================
# Pre-build the note index in a daemon thread so the first /api/notes request # Pre-build the note index off the request path. Mid-warmup requests are safe
# hits a warm index. Concurrent requests landing mid-warmup are safe: bulk_set # (bulk_set is serialized and short-circuits on the fingerprint).
# is serialized by the index RLock and short-circuits via the fingerprint hash.
@app.on_event("startup") @app.on_event("startup")
def _warmup_note_index() -> None: def _warmup_note_index() -> None:
import threading import threading

View File

@ -12,7 +12,6 @@ import re
logger = logging.getLogger("uvicorn.error") logger = logging.getLogger("uvicorn.error")
# Average reading speed used to derive `reading_time_minutes`.
WORDS_PER_MINUTE = 200 WORDS_PER_MINUTE = 200

4
run.py
View File

@ -37,7 +37,6 @@ def get_port():
return "8000" return "8000"
def main(): def main():
# Make sure runtime deps are present before invoking uvicorn.
try: try:
import fastapi # noqa: F401 import fastapi # noqa: F401
import uvicorn # noqa: F401 import uvicorn # noqa: F401
@ -50,9 +49,6 @@ def main():
port = get_port() port = get_port()
# Short pre-launch banner. Detailed startup logs come from uvicorn /
# backend.main below (INFO: / WARNING: / ERROR:), so the user can tell
# exactly when the server is actually accepting connections.
print(f"🚀 NoteDiscovery → http://localhost:{port}") print(f"🚀 NoteDiscovery → http://localhost:{port}")
print(f" notes: ./data/ plugins: ./plugins/ stop: Ctrl+C") print(f" notes: ./data/ plugins: ./plugins/ stop: Ctrl+C")
print() print()