Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deflake msgindex_test.go #10826

Merged
merged 1 commit into from
May 4, 2023
Merged

feat: deflake msgindex_test.go #10826

merged 1 commit into from
May 4, 2023

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented May 4, 2023

Related Issues

This test has been observed to fail unpredictably (eg. here). The issue is that we don't necessarily wait long enough for changes in the Coalescer to be dispatched before polling the index, which leads to failure.

Proposed Changes

  • Wait the actual minimum time (2 * CoalescerMinDelay), plus a slightly more generous time (1 second) for events to be processed
  • Do NOT wait after every single head change, but only the "last" one. We can trust the coalescer to be dispatching these events correctly without us waiting each time.

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@arajasek arajasek requested a review from a team as a code owner May 4, 2023 16:59
Comment on lines +301 to +307
func waitForCoalescerAfterLastEvent() {
// It can take up to CoalesceMinDelay for the coalescer timer to fire after the last event.
// When the timer fires, it can wait up to CoalesceMinDelay again for more events.
// Therefore the total wait is 2 * CoalesceMinDelay.
// Then we wait another second for the listener (the index) to actually process events.
time.Sleep(2*CoalesceMinDelay + time.Second)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding to the itest kit? 🤔

@arajasek arajasek merged commit 45f3e69 into master May 4, 2023
89 of 92 checks passed
@arajasek arajasek deleted the asr/deflake-msgindex branch May 4, 2023 17:39
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.

None yet

2 participants