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

Make sure AR Trilogy adpater does not modify input #474

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

miry
Copy link
Contributor

@miry miry commented Feb 13, 2023

During working with Trilogy adapter,
found that semian key removed from the original Hash.

Update adapter to use copy of input structure, instead of modify the object it self.

Example how to reproduce the problem:

SEMIAN_PARAMETERS = {
  circuit_breaker: true,
  success_threshold: 1,
  error_threshold: 3,
  error_timeout: 3,
  bulkhead: false,
}

configuration = {
  adapter: "trilogy",
  username: "root",
  host: ENV.fetch("MYSQL_HOST", "localhost"),
  port: Integer(ENV.fetch("MYSQL_PORT", 3306)),
  database: "mysql",
  semian: SEMIAN_PARAMETERS,
}

adapter = ActiveRecord::ConnectionAdapters::TrilogyAdapter.new(configuration)
adapter.execute("SELECT 1;")

adapter = ActiveRecord::ConnectionAdapters::TrilogyAdapter.new(configuration)
adapter.execute("SELECT 1;")
# Print in logs that Semian is not configured

@miry miry self-assigned this Feb 13, 2023
@miry miry added the Semian label Feb 13, 2023
@miry miry merged commit 6e332f9 into master Feb 13, 2023
@miry miry deleted the trilogy-mmutable-input branch February 13, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant