- Python 95.9%
- Dockerfile 4.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Publish container image / publish (push) Successful in 5m8s
Reviewed-on: #1 |
||
| .forgejo/workflows | ||
| tests | ||
| .dockerignore | ||
| app.py | ||
| Dockerfile | ||
| LICENSE | ||
| lobsters-bisque.py | ||
| README.md | ||
| requirements.txt | ||
lobsters-bisque
A small HTTP API that serves an RSS feed of Lobsters stories scoring at least two points. Item links point to the Lobsters discussion page.
Run locally
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python app.py
The feed is available at http://localhost:8000/rss and the health endpoint is http://localhost:8000/healthz.
Caching
The API retains the rendered feed in memory for 10 minutes by default. All requests during that interval receive the cached response, so Lobsters is fetched at most once per process per interval. Refreshing is serialized, preventing simultaneous cache misses from generating duplicate upstream requests. If refresh fails after a successful response, the last good feed remains available for the next interval.
Score requests are also paced by 100 ms. Set CACHE_TTL_SECONDS to choose another interval or SCORE_REQUEST_DELAY_SECONDS to choose another delay. The cache is process-local; the container intentionally uses one Gunicorn worker so all requests share it.
Docker
docker build -t lobsters-bisque .
docker run --rm -p 8000:8000 -e CACHE_TTL_SECONDS=600 lobsters-bisque
Testing
python -m unittest discover -s tests