Skip to content

Conversation

hank95179
Copy link

Stabilize flaky PUBSUB test by waiting for subscriptions to establish

Issue link

This Pull Request is linked to issue (URL): #4695

Similar fix for reference: #4623


What & Why

Flaky test: PubSub › pubsub combined exact and pattern multiple clients test_true_0

Root cause
Right after creating clients with PUBSUB subscriptions, the test immediately publishes messages. On slower or contended environments, publishes can race ahead of the subscription handshake (server hasn’t fully registered the subscriber yet), causing dropped messages and timeouts.

Fix (minimal, no hooks, no new helpers):
Insert a short await after subscription setup and before publishing. This gives the subscription time to become active.

// Wait for subscriptions to be established (cluster & standalone)
await new Promise((resolve) => setTimeout(resolve, 1000));

@hank95179 hank95179 requested a review from a team as a code owner October 16, 2025 18:47
Copy link
Collaborator

@jamesx-improving jamesx-improving left a comment

Choose a reason for hiding this comment

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

LGTM

@jamesx-improving
Copy link
Collaborator

Hi @hank95179 , thank you for your contribution! The fix looks good, the only thing is, we have a policy that all commits needs to have signing and signoff. We can help merge your PR after these are being taken care of.

Thanks again!

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