dan-polling
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v11View latest version
Monitors Dan's ATProto DID endpoint every minute, stores results in SQLite, and sends an hourly email digest.
Rendering mermaid diagram...
| File | Type | Description |
|---|---|---|
main.ts | Interval (1 min) | Polls the endpoint, records status code & latency into SQLite |
hourly-email.ts | Interval (1 hr) | Queries SQLite for stats and sends an HTML email digest |
dashboard.tsx | HTTP | Web dashboard showing response time chart, stats, and poll log |
Uses a val-scoped SQLite database (std/sqlite@14-main) with a single table:
CREATE TABLE poll_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
started_at TEXT NOT NULL,
ended_at TEXT NOT NULL,
duration_ms INTEGER NOT NULL,
status_code INTEGER,
error TEXT
);
Hourly digest emails are sent via std/email and include:
- Last hour: poll count, uptime %, avg/min/max response time, error count
- All time: total polls, uptime %, avg response time, total errors
- Error table: recent failures with timestamps, status codes, and messages
