Minimal HTTP webhook sink that stores events in SQLite.
From the repo root:
uv run -m src.server.server
Optional: direct file run (adds import path explicitly):
PYTHONPATH=. uv run src/server/server.py
Server listens on http://127.0.0.1:8000.
The server uses a threaded HTTP server (see src/server/server.py). Each incoming request is processed in its own thread. That means concurrent requests are handled in parallel (e.g. 30 requests → ~30 handler threads, subject to OS limits).
Within a single request, execution is synchronous/blocking (no async/await). Any shared resources must therefore be thread‑safe.
SQLite’s Python driver normally restricts a connection to the thread that created it. Because the server is multi‑threaded, a single shared connection would crash on the first request handled by another thread.
To avoid that in this project, the SQLite client:
- Opens the connection with
check_same_thread=False, allowing cross‑thread use. - Serializes all DB operations with a lock, so only one thread accesses SQLite at a time.
This is fine for local/dev or low‑throughput use. For scalable production, use a server‑grade DB (PostgreSQL/MySQL) with proper connection pooling instead of SQLite.