Repository navigation
fix(subscriptions): stop a subscription delete from disconnecting its subscribers - #20
Conversation
PR SummaryMedium Risk Overview Subscription checkpoint writes are now observable via telemetry. Each persisted checkpoint emits Reviewed by Cursor Bugbot for commit 2aa0d16. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe change updates subscription deletion to stop a subscription only when no subscribers remain. It reports ChangesSubscription deletion coordination
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant EventStore
participant Supervisor
participant Subscription
EventStore->>Supervisor: stop_subscription/3
Supervisor->>Subscription: stop_unless_subscribed
Subscription-->>Supervisor: termination result
Supervisor-->>EventStore: deletion result
Merge Risk: ⚪ Minimal · up to The deletion result is consistent with the intentional public contract, and deletion waits for shutdown before checking process liveness. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit reads each line, Comment |
… subscribers Deleting a subscription tore down the process that every one of its subscribers shares, so a caller holding none of it could destroy a live subscription and erase the checkpoint it was working through, with the subscribers learning about it only from the resulting `:DOWN`. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Asking whether a subscription has subscribers and then stopping it were two separate calls, so a subscriber could connect in the gap between them and still be torn down by the very delete its presence should have refused. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ady going down Unsubscribing answers before the subscription it stops has terminated, so a delete that follows it could reach a process that no longer answers calls and take the caller down with it. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
57494c2 to
886302f
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…isconnect Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…refused Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
… one is in flight Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
… of assuming it Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…s the row A checkpoint deferred past the reply would have its stale last_seen land on whichever subscription holds the name next, and nothing else declares that it cannot be deferred. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 739df40. Configure here.
… has to wait for A subscription is given fifteen seconds to write a checkpoint and the call asking it to stop waited five, so a slow write reached the caller as a crash rather than as the wait it is. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…t wrote it A named instance reported its own name as the event store, so its checkpoints could not be lined up against any other operation it emitted. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ts for a checkpoint A deadline the caller cannot see or set is a deadline they cannot reason about, and the event store already takes a :timeout for exactly this. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>

:DOWN, which is indistinguishable from the event store going away.:okwhile subscribers were connected now answers{:error, :subscription_has_subscribers}, which the callback already declared as possible. Callers that relied on it to force a disconnect must unsubscribe first.