···241 profileCache: make(map[string]*CachedProfile),
242 }
243244+ // If the database already has records from a previous run, mark ready immediately
245+ // so the feed is served from persisted data while the firehose reconnects.
246+ var count int
247+ if err := db.QueryRow(`SELECT COUNT(*) FROM records`).Scan(&count); err == nil && count > 0 {
248+ idx.ready = true
249+ }
250+251 return idx, nil
252}
253