Skip to content

Conversation

@iuwqyir
Copy link
Contributor

@iuwqyir iuwqyir commented Feb 18, 2025

TL;DR

Replaced ticker with sleep interval in committer and added empty data check for block insertions

What changed?

  • Replaced time.NewTicker with time.Sleep in the committer's main loop
  • Added validation to prevent processing empty block data in InsertBlockData

How to test?

  1. Run the test suite to verify committer functionality
  2. Verify committer continues to process blocks at the specified interval
  3. Test InsertBlockData with empty block data to ensure it handles the case gracefully

Why make this change?

Ticker will trigger on the nearest configured time tick. Meaning that if the interval is 1 second and loop finishes at 0.999, then the next loop will start in 1 millisecond.

This can create cases where the next committer loop reads the DB to get the latest block, but it hasn't propagated to all distributed DB machines yet and thus returns an old block and the loop will commit the same data as the last loop.

Using sleep will fix this because it will always wait the configured interval after the previous commit is done

@zeet-co
Copy link

zeet-co bot commented Feb 18, 2025

We're building your pull request over on Zeet.
Click me for more info about your build and deployment.
Once built, this branch can be tested at: https://debug-xai-cbng-02-18-fix-duplicat-0aebce.insight-prod-gke.zeet.app before merging 😉

Copy link
Contributor Author

iuwqyir commented Feb 18, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@iuwqyir iuwqyir force-pushed the 02-18-fix_duplicate_inserts branch from acb0d5f to 216eecd Compare February 18, 2025 21:02
@iuwqyir iuwqyir marked this pull request as ready for review February 18, 2025 21:16
@iuwqyir iuwqyir requested a review from a team February 18, 2025 21:16
Base automatically changed from 02-13-improve_token_balances_mv to main February 19, 2025 09:31
@iuwqyir iuwqyir merged commit d3f0977 into main Feb 19, 2025
5 of 6 checks passed
@iuwqyir iuwqyir deleted the 02-18-fix_duplicate_inserts branch February 19, 2025 09:32
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.

3 participants