Skip to content

Support connection pooling (thread safe) & auto discovery#239

Merged
Surgo merged 14 commits intomainfrom
topic/support_pool_auto_discovery
Nov 2, 2025
Merged

Support connection pooling (thread safe) & auto discovery#239
Surgo merged 14 commits intomainfrom
topic/support_pool_auto_discovery

Conversation

@Surgo
Copy link
Copy Markdown

@Surgo Surgo commented Oct 27, 2025

About

@Surgo Surgo force-pushed the topic/support_pool_auto_discovery branch from 613a5cd to 37571bc Compare November 2, 2025 12:59
@Surgo Surgo marked this pull request as ready for review November 2, 2025 15:15
@Surgo Surgo self-assigned this Nov 2, 2025
name: Publish to PyPi
runs-on: ubuntu-latest
environment:
name: pypi
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

logger = logging.getLogger(__name__)

# Accept either host:port or [IPv4]:port
_AWS_CONFIGURATION_ENDPOINT_PATTERN = re.compile(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

logger.warning("Exception occurred while closing ElastiCache client", exc_info=True)

def _close_configuration_endpoint_client(self) -> None:
if not self._configuration_endpoint_client:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

)


class _ConfigurationEndpointClient:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

if old_client:
old_clients.append(old_client)

self.hasher.remove_node(client_key)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

R = TypeVar("R")


def _retry_refresh_clients(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

📝 Support retry_attempts

use_vpc_ip_address=use_vpc_ip_address,
)

self._configuration_endpoint_client = RetryingClient(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

📝 Support retry_attempts

return

now = time.monotonic()
if not force and (now - self._last_discovery_time) < self._discovery_interval:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

📝 Auto (only first time) discovery 🤔

pinterest/pymemcache#572

Copy link
Copy Markdown

@heavenshell heavenshell left a comment

Choose a reason for hiding this comment

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

LGTM!

@Surgo Surgo merged commit 16e54f4 into main Nov 2, 2025
16 checks passed
@Surgo Surgo deleted the topic/support_pool_auto_discovery branch November 2, 2025 16:50
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.

2 participants