Skip to content

fix(subscriptions): keep a checkpoint that failed to write so the next one retries it - #71

Merged
yordis merged 2 commits into
yordis/fix-retry-timer-dedupefrom
yordis/fix-checkpoint-retry-after-error
Oct 26, 2026
Merged

yordis merged 2 commits into
yordis/fix-retry-timer-dedupefrom
yordis/fix-checkpoint-retry-after-error

Conversation

@yordis

@yordis yordis commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

@cursor

cursor Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes subscription position persistence and adds a required retry_interval on SubscriptionFsm.new; misconfiguration or retry bugs could delay or duplicate checkpoint behavior.

Overview
Subscription checkpoint persistence retries when ack_last_seen_event fails for ordinary storage errors, instead of clearing checkpoints_pending and abandoning the unwritten position until another ack.

Checkpoint timing is refactored around schedule_checkpoint, with write_checkpoint handling outcomes: success and :subscription_not_found / :fenced behave as before; other errors schedule a :checkpoint timer. Retry delay uses checkpoint_after when set, otherwise the new required retry_interval option (aligned with subscribe retry timing for per-ack checkpoints).

Tests cover successful retry after a failed write, timer delays for both modes, and adjusted expectations when a write fails without being classified as fenced.

Reviewed by Cursor Bugbot for commit 360001f. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bbcc2685-dfba-4f9e-8150-65fdf2cfe515
Commits

Reviewing files that changed from the base of the PR and between d5116c4 and 9accec6.

Files selected for processing: 4
  • lib/event_store/subscriptions/subscription_fsm.ex
  • lib/event_store/subscriptions/subscription_state.ex
  • test/subscriptions/subscription_fsm_test.exs
  • test/subscriptions/support/stream_subscription_test_case.ex
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yordis
yordis added this pull request to stack #73 October 26, 2026 16:00
@yordis yordis changed the title yordis/fix checkpoint retry after error fix(subscriptions): keep a checkpoint that failed to write so the next one retries it Oct 26, 2026
@yordis
yordis force-pushed the yordis/fix-checkpoint-retry-after-error branch from 360001f to 4ac3550 Compare October 26, 2026 16:16
@yordis
yordis removed this pull request from stack #73 October 26, 2026 16:53
@yordis
yordis force-pushed the yordis/fix-checkpoint-retry-after-error branch from 4ac3550 to 10089aa Compare October 26, 2026 16:54
@yordis
yordis added this pull request to stack #74 October 26, 2026 17:10
@yordis
yordis force-pushed the yordis/fix-checkpoint-retry-after-error branch 3 times, most recently from 62f3db5 to a53eb54 Compare October 26, 2026 19:31
…ng written

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…t one retries it

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
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.

1 participant