Skip to content

Count model info cache in last index calculation - #87

Merged
askar-zinurov-flant merged 6 commits into
masterfrom
get-updates-pass-last-index
Aug 5, 2026
Merged

askar-zinurov-flant merged 6 commits into
masterfrom
get-updates-pass-last-index

Conversation

@askar-zinurov-flant

@askar-zinurov-flant askar-zinurov-flant commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make Message.latest_index use max(max(artery_messages.id), model_infos.last_published_id), so get_all / empty get_updates still return the real publisher cursor when artery_messages is empty (cleanup / dumps).
  • Add Model.artery_rewind_message_counter!(service:) to rewind a subscriber’s latest_index to the publisher cursor via get_all when the local index is ahead.
  • Add Subscription#reset_info! to clear memoized subscription info (needed for tests; subscription instances live for the process lifetime).

Test plan

  • Specs for Message.latest_index with empty messages + last_published_id
  • Specs for Recipient.artery_rewind_message_counter! (ahead / behind / zero / error / source model)
  • Confirm Recipient subscription specs still see latest_index == 0 after rewind examples (reset_info!)

Comment thread lib/artery/subscription/synchronization.rb Outdated
Comment thread lib/artery/active_record/model_info.rb Outdated
Comment thread lib/artery/active_record/message.rb Outdated
@askar-zinurov-flant
askar-zinurov-flant merged commit f73b84f into master Aug 5, 2026
2 checks passed
@askar-zinurov-flant
askar-zinurov-flant deleted the get-updates-pass-last-index branch August 5, 2026 12:31
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.

2 participants