···241241 profileCache: make(map[string]*CachedProfile),
242242 }
243243244244+ // If the database already has records from a previous run, mark ready immediately
245245+ // so the feed is served from persisted data while the firehose reconnects.
246246+ var count int
247247+ if err := db.QueryRow(`SELECT COUNT(*) FROM records`).Scan(&count); err == nil && count > 0 {
248248+ idx.ready = true
249249+ }
250250+244251 return idx, nil
245252}
246253