connector: don't save reconnection state before events are handled - #308
Open
Fizzadar wants to merge 1 commit into
Open
connector: don't save reconnection state before events are handled#308Fizzadar wants to merge 1 commit into
Fizzadar wants to merge 1 commit into
Conversation
The messagix sync cursor advances as soon as a table is parsed and queued, so persisting the dumped state while the derived events are still queued (or were dropped when the context was cancelled) checkpoints past work that never happened. Meta then never re-reports those thread ranges, so any messages in them are lost permanently. Count outstanding parsed tables and skip saving the state while any are unhandled. The counter is swapped for a fresh one when a new messagix client is created, so a late decrement from the old table loop can't make the new connection look up to date. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fizzadar
marked this pull request as ready for review
July 27, 2026 14:18
Fizzadar
commented
Jul 30, 2026
| if pending := m.pendingTables.Load().Load(); pending != 0 { | ||
| zerolog.Ctx(ctx).Warn(). | ||
| Int64("pending_tables", pending). | ||
| Msg("Not saving reconnection state, some events haven't been handled yet") |
Member
Author
There was a problem hiding this comment.
I think this is safe as we'll just save it later?
Member
|
Hmm, the saving should probably just be a part of the event stream like it is on instagram rather than a hacky atomic atomic integer |
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.
The messagix sync cursor advances as soon as a table is parsed and queued, so persisting the dumped state while the derived events are still queued in memory. If the process restarts in this situation those events are lost forever.