Skip to content

Conversation

@karenc-bq
Copy link
Contributor

@karenc-bq karenc-bq commented Jan 22, 2026

Description

Aurora Connection Tracker is outdated.
This PR ports over some improvements and fixes for the plugin.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq karenc-bq force-pushed the fix/aurora-connection-tracker branch 3 times, most recently from 1a01f31 to fcdd465 Compare January 22, 2026 21:14
@karenc-bq karenc-bq force-pushed the fix/aurora-connection-tracker branch from fcdd465 to 1e05ee3 Compare January 22, 2026 21:35
Comment on lines +56 to +59
def _start_prune_thread(cls):
if cls._prune_thread is None or not cls._prune_thread.is_alive():
cls._prune_thread = Thread(daemon=True, target=cls._prune_connections_loop)
cls._prune_thread.start()
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a lock for this, it's more rare, but we could have 2 initial connections both calling this and starting 2 threads.

_opened_connections: ClassVar[Dict[str, WeakSet]] = {}
_rds_utils: ClassVar[RdsUtils] = RdsUtils()
_prune_thread: ClassVar[Optional[Thread]] = None
_shutdown_event: ClassVar[threading.Event] = threading.Event()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is never set so thread is never shut down. Maybe we should have this in the release_resources method in the wrapper.py and change this in a release_resources() method or something like that).

while not cls._shutdown_event.is_set():
try:
cls._prune_connections()
time.sleep(cls._default_sleep_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably do a wait on the event instead of a sleep:
e.g.

if cls._shutdown_event.wait(timeout=cls._default_sleep_time):
            break

It's a daemon thread so it won't cause the program to hang, but just incase, this will help with making it exit gracefully.

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