Skip to content

chore: move skipped cluster slots tracking to web worker#348

Draft
asuzuki-jumptrading wants to merge 1 commit into
asuzuki/epoch-webworkerfrom
asuzuki/skipped-webworker
Draft

chore: move skipped cluster slots tracking to web worker#348
asuzuki-jumptrading wants to merge 1 commit into
asuzuki/epoch-webworkerfrom
asuzuki/skipped-webworker

Conversation

@asuzuki-jumptrading

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves “skipped cluster slots” tracking out of the main thread and into the WebSocket worker, so UI state is driven by worker-produced derived data instead of client-side incremental updates.

Changes:

  • Removed main-thread Jotai write-atoms for skipped cluster slots and replaced them with a single skippedClusterSlotsAtom set by worker messages.
  • Updated the worker to maintain skipped cluster slot state (including epoch-bound pruning) and emit a new skippedClusterSlots message.
  • Filtered slot:skipped_history_cluster (and epoch) WS entities from being forwarded as regular batched KV updates to the UI.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/atoms.ts Removes local skipped-slot mutation atoms; keeps a single atom holding the current skipped cluster slot Set.
src/api/worker/wsWorker.ts Filters slot:skipped_history_cluster from KV batching while still processing it in the worker handler.
src/api/worker/types.ts Extends worker message types to include skippedClusterSlots and excludes skipped_history_cluster from forwarded KV entities.
src/api/worker/messageHandler.ts Updates worker-side message handling to maintain skipped slot state and publish it to the UI.
src/api/worker/cache/epochCache.ts Adds skipped-slot Set management and epoch-based pruning inside the worker cache.
src/api/useSetAtomWsData.ts Consumes the new skippedClusterSlots worker message and removes main-thread skipped-slot tracking logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +105 to +112
addSkippedClusterSlots(slots: number[]) {
const initialSize = skippedClusterSlots.size;
for (const slot of slots) {
skippedClusterSlots.add(slot);
}
if (initialSize !== skippedClusterSlots.size) {
postSkippedClusterSlots(skippedClusterSlots);
}
Comment thread src/api/worker/types.ts
Comment on lines +79 to 82
| {
type: "skippedClusterSlots";
slots: Set<number>;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants