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

Remove an arbitrary sleep of 500 milliseconds. #1106

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rcl/test/rcl/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,13 @@ TEST_F(
}

// Give a brief moment for publications to go through.
// TODO(clalancette): We should have a way to "peek" at how much data is available, without
// taking it. Then we could block until we see that amount, letting us remove this sleep and
// the do..while loop below.
std::this_thread::sleep_for(std::chrono::milliseconds(500));
// Take fewer messages than are available in the subscription
{
size_t size = 3;
constexpr size_t size = 3;
rmw_message_info_sequence_t message_infos;
rmw_message_info_sequence_init(&message_infos, size, &allocator);

Expand All @@ -563,7 +566,7 @@ TEST_F(
// `wait_for_subscription_to_be_ready` only ensures there's one message ready,
// so we need to loop to guarantee that we get the three published messages.
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 1, 100));
ret = rcl_take_sequence(&subscription, 3, &messages, &message_infos, nullptr);
ret = rcl_take_sequence(&subscription, size, &messages, &message_infos, nullptr);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
total_messages_taken += messages.size;
EXPECT_EQ(messages.size, message_infos.size);
Expand Down