Skip to content

Conversation

@Kingvornex
Copy link

📝 Pull Request Description:

This PR improves the proxy rotation mechanism in Telegram by reducing delay when switching proxies.

✨ Changes:

Immediately connects to the first available proxy once it successfully responds to a ping.

Avoids waiting for all proxy ping checks to complete before switching.

Uses a hasSwitched flag to ensure only one switch happens per rotation check.

Retains switchToAvailable() as a fallback if no proxy responds.

📈 Benefits:

Much faster proxy switching during network instability or failover.

Better experience in regions with partial blocking or when using unreliable proxies.

Reduces unnecessary wait times by prioritizing responsiveness over completeness.

Improves proxy switching logic by connecting to the first proxy that responds,
instead of waiting for all proxy pings to complete.

- Adds hasSwitched flag to prevent multiple switches
- Speeds up failover and improves user experience with unreliable proxies
Ensure hasSwitched is reset in switchToAvailable() to prevent stale flag from blocking future proxy switches after failed or skipped checks.
- Documented class purpose, fields, and methods
- Explained logic for proxy checking, switching, and notification handling
- Clarified rotation fallback and concurrency safeguards
- Improved readability and maintainability for future development
@yashikada
Copy link

It looks like you used ChatGPT to generate the code.
The comments have the usual emojis that ChatGPT uses when generating the code.

@BOplaid
Copy link

BOplaid commented Oct 24, 2025

😐

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