chore: move skipped cluster slots tracking to web worker#348
Draft
asuzuki-jumptrading wants to merge 1 commit into
Draft
chore: move skipped cluster slots tracking to web worker#348asuzuki-jumptrading wants to merge 1 commit into
asuzuki-jumptrading wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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
skippedClusterSlotsAtomset by worker messages. - Updated the worker to maintain skipped cluster slot state (including epoch-bound pruning) and emit a new
skippedClusterSlotsmessage. - 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 on lines
+79
to
82
| | { | ||
| type: "skippedClusterSlots"; | ||
| slots: Set<number>; | ||
| }; |
amliu-jumptrading
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.