Refactor tracker flushing#14
Merged
Merged
Conversation
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/effect.ts">
<violation number="1" location="src/effect.ts:196">
P1: The drain operation inside `withPermit` is interruptible. If `shutdown` interrupts the interval fiber while it's mid-drain (after `takeBatch` removes items from the queue but before `sendWithRetries` completes), those events are lost permanently. Mark the critical section as uninterruptible so that an in-flight batch completes delivery before the fiber responds to the interrupt.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Owner
Author
|
@cubic-dev-ai can we review the whole codebase? |
@deepso7 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/effect.ts">
<violation number="1" location="src/effect.ts:224">
P2: Race condition: concurrent `track` calls can both pass the `intervalFiber !== undefined` guard and fork duplicate interval fibers, leaking the first. Consider wrapping `ensureFlushInterval` with the semaphore or using a `Ref` with an atomic compare-and-set to guard fiber creation.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
Summary
Verification
Summary by cubic
Refactors tracker buffering and flushing to use
effectqueues, schedules, and semaphores, removing manual arrays and timers. Protects interval flush delivery during shutdown, serializes interval setup, and reports interval flush errors for better reliability.Refactors
Queue.droppingand semaphores for uninterruptible draining and serialized interval setup.src/index.ts; interval handling now lives in the Effect tracker.New Features
Schedule.duration(default 5s, configurable withflushInterval).onError.Written for commit 5112836. Summary will update on new commits.