Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce retained references to ConnectionContext #260

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

mirromutth
Copy link
Contributor

@mirromutth mirromutth commented Mar 14, 2024

Motivation:

A small refactoring of ConnectionContext usage.

It is based on challenges #228 and #89. If a MySQL connection is reconnected or redirected, the ConnectionContext needs to be recreated. If we accidentally retain a reference to ConnectionContext outside the client package, it may cause some unexpected behavior.

Of course, there are some counterexamples here, such as MySqlDataRow that needs to retain the CodecContext in which it was responded to. Regardless of whether the connection changes, the CodecContext should be always the context of the connection which was responding to this row, instead of the current connection.

Modification:

  • Reduce publicity
  • Prepare to support redirect and reconnect

Result:

Remove ConnectionContext reference that's retained outside client package, except those required by codecs

- Reduce publicity
- Prepare to support redirect and reconnect
@mirromutth mirromutth added the enhancement New feature or request label Mar 14, 2024
@mirromutth mirromutth added this to the 1.1.3 milestone Mar 14, 2024
@mirromutth mirromutth requested a review from jchrys March 14, 2024 05:33
@mirromutth mirromutth marked this pull request as ready for review March 14, 2024 05:35
Copy link
Collaborator

@jchrys jchrys left a comment

Choose a reason for hiding this comment

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

LGTM

@mirromutth mirromutth merged commit e54b69b into trunk Mar 15, 2024
15 checks passed
@mirromutth mirromutth deleted the refactor/client/context branch March 15, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants