Skip to content

Conversation

@hank95179
Copy link
Contributor

@hank95179 hank95179 commented Dec 12, 2025

Issue link

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

Description

This PR addresses the flakiness observed in TestSyncPubSub.test_sync_pubsub_exact_happy_path.
In high-load environments (e.g., CI/CD), initializing two synchronous clients simultaneously occasionally results in a ClosingError: connection attempt timed out.

Solution

Implemented a retry mechanism in tests/sync_tests/test_sync_pubsub.py.

  • Wrapped the create_two_clients_with_pubsub call in a retry loop.
  • The test now attempts to create the clients up to 3 times (with a Binary Exponential Backoff) before failing, ensuring robustness against transient connection timeouts.

Verification

Verified that the test is more resilient to resource contention and transient network delays during client creation.

@hank95179 hank95179 requested a review from a team as a code owner December 12, 2025 08:17
@hank95179 hank95179 force-pushed the fix-issue-4970-sync-pubsub branch 2 times, most recently from 021cd7d to f617809 Compare December 12, 2025 09:12
@hank95179 hank95179 force-pushed the fix-issue-4970-sync-pubsub branch from f617809 to 15daa40 Compare December 13, 2025 10:14
@yipin-chen yipin-chen changed the title [Python] Fix flaky test test_sync_pubsub_exact_happy_path #4970 [Python] Fix flaky test test_sync_pubsub_exact_happy_path Jan 2, 2026
@xShinnRyuu xShinnRyuu merged commit 9e64c59 into valkey-io:main Jan 5, 2026
26 checks passed
tdschwarz pushed a commit to tdschwarz/valkey-glide that referenced this pull request Jan 9, 2026
…o#5057)

Fix flaky test valkey-io#4970: Add retry mechanism for Sync PubSub client creation

Signed-off-by: hank95179 <[email protected]>
Co-authored-by: Thomas Zhou <[email protected]>
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.

[Python][Flaky Test] TestSyncPubSub.test_sync_pubsub_exact_happy_path

3 participants