Skip to content

Commit

Permalink
misc: Address follow up comment re. abort exchange test (#11966)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #11966

Assert on the use_count condition of the merge task instead of waiting for sleep to reduce flakiness

Reviewed By: xiaoxmeng

Differential Revision: D67655127

fbshipit-source-id: bf4dd2ba5027c990fd0edcf868ec3a2d9b44458a
  • Loading branch information
yuandagits authored and facebook-github-bot committed Dec 27, 2024
1 parent 9e418b1 commit 7153db6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions velox/exec/tests/MultiFragmentTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,11 @@ TEST_P(MultiFragmentTest, abortMergeExchange) {
// Ensure that the threads in the executor can gracefully join
executor.join();

/* sleep override */
// Wait till all the terminations, closures and destructions are done.
std::this_thread::sleep_for(std::chrono::seconds(1));
// Wait till all the terminations, closures and destructions so that
// the reference count drops to 2.
while (mergeTask.use_count() > 2) {
std::this_thread::yield();
}

// The references to mergeTask should be two, one for the local variable
// itself and one reference inside tasks variable.
Expand Down

0 comments on commit 7153db6

Please sign in to comment.