You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(citations): rebuild citation rollups shortly after a topic move, not at the nightly sweep #1001
The Citations daily rollups (00118) store topic_id in their rows. When a prompt moves to another topic, or is deleted, the trigger on prompts adds the brand to citation_rollup_rebuilds. The queue is only processed by rebuildQueuedCitationRollups() at the end of the nightly sweep (sweepInsightsRollups()).
Until then, the Citations page's topic filter shows the moved prompt's citations under its old topic. Depending on when the move happens, that lasts up to a day. A user who reorganizes topics and checks the result right away sees no change.
Proposal
Process the queue shortly after a change instead of waiting for the nightly sweep:
Schedule rebuildQueuedCitationRollups() on its own, every few minutes, next to the existing node-cron schedules in server/src/server.js. When the queue is empty the run is a single select.
Keep the call at the end of the nightly sweep as a fallback.
Don't let two runs overlap. A full-history rebuild of a large brand takes a few minutes (14-day chunks of ~12s each).
Bulk edits need nothing new: a brand re-queued while it is being rebuilt keeps its queue entry, because the entry is cleared only when requested_at has not moved.
Acceptance criteria
After a prompt moves topic, the Citations topic filter reflects it within the schedule interval plus the rebuild time.
Activity
perf(citations): drain the topic-move rebuild queue every 5 minutes (a…