Files
routewatch/TODO.md
T
sneak 698390f66c
check / check (push) Successful in 2m20s
Serve /api/v1/stats counts from realtime in-memory counters (closes #27)
The stats endpoints recomputed every count with a COUNT(*) over each
table plus a MIN/MAX union scan on every request, which took the whole
timeout and returned 500 once the database passed a few GiB.

The row counts (ASNs, prefixes, peerings, peers, live routes) now live
in memory: seeded once at startup and adjusted on each write as routes
and records are inserted, updated and removed, so a read serves them
with no scan and no timer. A live-route upsert is an UPDATE, then an
INSERT only when no row matched, so its rows-affected count tells a new
route from a re-announced one. Oldest/newest timestamps read one row
from each end of the last_updated index, which also fixes the per-call
scan warning. The distinct-prefix histogram stays a single indexed
query.

JSON shape of /api/v1/stats and the status page is unchanged.

Model: opus-4-8
2026-09-22 07:23:43 +00:00

53 lines
2.1 KiB
Markdown

# Workflow
* branch (from `main`)
* do the work in Next Step
* move Next Step to the top of Completed Steps
* move the top item of Future Steps into Next Step
* commit (`TODO.md` changes in the same commit as the work)
* merge to `main` if the branch is not protected, otherwise open a PR
* push
# Status
pre-1.0. No git tags. Runs in production-style Docker deployment, but
the policy compliance branch (repo-policies-compliance, make check
passing, clean tree) is unmerged to main and the CI workflow is missing.
# Next Step
Merge repo-policies-compliance into main (3 commits: policy files and
.gitignore, Makefile targets fmt-check/check/docker/hooks, gofmt pass),
then add .gitea/workflows/check.yml as a small follow-up commit so CI
runs make check on main.
# Completed Steps
- 2026-09-22: realtime in-memory database statistics: counts seeded at
startup and adjusted on every write, oldest/newest route timestamps via
index-end lookups; `/api/v1/stats` no longer scans the tables (closes
#27)
- 2026-07-07 Adopted scripts-to-rule-them-all: `script/` entrypoints,
Makefile shims, README Entrypoints section
- 2026-02-22: repo policy compliance: required policy files, .gitignore
update, Makefile fmt-check/check/docker/hooks targets, gofmt pass
(repo-policies-compliance, unmerged)
- 2026-01-01: WAL checkpointing: periodic (5s), on startup with logging,
TRUNCATE mode; fixed slow queries
- 2025-12-31: status page: navbar, home page with search, oldest/newest
route timestamps, NULL handling in WHOIS stats; container runs as
routewatch user with proper state dir
- 2025-12-30: structured HTTP request logging, increased timeouts,
CIDR prefix URL routing fixes, status page metrics and footer
- 2025-12-29: Dockerfile multi-stage build with source archive; SQLite
incremental vacuum for non-blocking space reclamation
- 2025-07-27: initial RouteWatch BGP stream monitor
# Future Steps
- Verify main is green after the merge: make check locally and the new
CI workflow passing
- Review stale remote branches fix-min-time-calculation and
optimize-sqlite-settings: land or delete
- Clean up the tmp/ directory at the repo root: gitignore or remove