Skip to content
Source
Sign inSign up
samwillis/hackernews-realtime
Open History to see the last commit

0005_ingest_smoothing.sql

13 lines602 Bytes

1-- Private, fenced work queue. Neither table participates in public live queries.
2CREATE TABLE IF NOT EXISTS hn_ingest_pending (
3 key text PRIMARY KEY,
4 due_at bigint NOT NULL,
5 received_at bigint NOT NULL,
6 revision bigint NOT NULL,
7 payload jsonb NOT NULL
8);
9CREATE INDEX IF NOT EXISTS hn_ingest_pending_due ON hn_ingest_pending(due_at);
10​
11-- The first worker reconciliation fills a discussion immediately, including
12-- rows omitted by the small cold-page seed. Only subsequent live changes wait.
13ALTER TABLE hn_threads ADD COLUMN IF NOT EXISTS ingest_initialized boolean NOT NULL DEFAULT false;