Skip to content

Commit

Permalink
Fix timing issue in pg_groups integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Kan-Ru Chen <[email protected]>
  • Loading branch information
kanru committed Jan 9, 2025
1 parent 9f46597 commit 3f252a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ractor_cluster_integration_tests/src/tests/pg_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ pub(crate) async fn test(config: PgGroupsConfig) -> i32 {
rpc_reply = ractor::call_t!(actor, ractor_cluster::NodeServerMessage::GetSessions, 200);
}

// wait until at least one remote actor has spawned
let tic = Instant::now();
loop {
let duration = Instant::now() - tic;
if duration.as_millis() > HELLO_ALLOTED_MS {
tracing::error!("Remote actor didn't join in allotted time");
return -1;
}
if ractor::pg::get_members(&"test".into())
.iter()
.any(|actor| !actor.get_id().is_local())
{
break;
}
}

if err_code == 0 {
// we're authenticated. Startup our PG group testing
let _ = ractor::cast!(test_actor, HelloActorMessage::Hey("Hey there".to_string()));
Expand Down

0 comments on commit 3f252a8

Please sign in to comment.