♊️ GemiNews 🗞️

Demo 1: Embeddings + Recommendation Demo 2: Bella RAGa Demo 3: NewRetriever Demo 4: Assistant function calling

🗞️Retry known idempotent SELECT queries, New Active Record configuration option, and more!

🗿Semantically Similar Articles (by :title_embedding)

Retry known idempotent SELECT queries, New Active Record configuration option, and more!

2024-03-29 - Emmanuel Hayford (from Ruby on Rails)

Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.   Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:

Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.   Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here: Action View Overview PR Action View Helpers PR Add config.active_record.permanent_connection_checkout setting This setting determines the action taken when ActiveRecord::Base.connection is accessed: whether it raises an error, emits a deprecation warning, or does nothing. ActiveRecord::Base.connection acquires a database connection from the pool and maintains it until the request or job concludes. However, this behaviour may prove undesirable in environments with more threads or fibers than available connections. This configuration facilitates the identification and elimination of code utilising ActiveRecord::Base.connection, encouraging migration to ActiveRecord::Base.with_connection instead. The default behaviour remains unaltered. Make ActiveSupport::BacktraceCleaner copy filters on dup Enhance ActiveSupport::BacktraceCleaner to replicate filters and silencers during duplication and cloning. Previously, duplication still resulted in shared internal silencers and filters arrays, leading to state leakage. Ensure necessary options are added to association options Noting the typo in :through, take the following code sample as an example: class User < ApplicationRecord has_many :courses has_many :assignments, trough: :courses end You’d get a misleading error along the lines of “Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors (ArgumentError)”, with this pull request, you’ll now get a clearer message, more like: “Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors, :through (ArgumentError)”. Note that in the second error message :through is included in the list of valid options. Retry known idempotent SELECT queries on connection-related exceptions Implements a mechanism to automatically retry SELECT queries that are known to be idempotent in the event of connection-related exceptions. Queries constructed through Arel tree traversal or based on known model attributes are inherently idempotent and can be safely retried upon encountering a connection error. Previously, certain adapters like TrilogyAdapter would raise ActiveRecord::ConnectionFailed: Trilogy::EOFError when faced with a connection error during a request. We had 22 contributors to the Rails codebase this past week! Take care. Your weekly inside scoop of interesting commits, pull requests and more from Rails. Subscribe to get these updates mailed to you.

[Technology] 🌎 https://rubyonrails.org/2024/3/29/this-week-in-rails-retry-known-idempotent-select-queries-new-active-record-configuration-option-and-more-b3dfc401

🗿article.to_s

------------------------------
Title: Retry known idempotent SELECT queries, New Active Record configuration option, and more!
Summary: Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.   Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:

[content]
Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.
 
Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:


  Action View Overview PR
  Action View Helpers PR


Add config.active_record.permanent_connection_checkout setting
This setting determines the action taken when ActiveRecord::Base.connection is accessed: whether it raises an error, emits a deprecation warning, or does nothing.

ActiveRecord::Base.connection acquires a database connection from the pool and maintains it until the request or job concludes. However, this behaviour may prove undesirable in environments with more threads or fibers than available connections.

This configuration facilitates the identification and elimination of code utilising ActiveRecord::Base.connection, encouraging migration to ActiveRecord::Base.with_connection instead. The default behaviour remains unaltered.

Make ActiveSupport::BacktraceCleaner copy filters on dup
Enhance ActiveSupport::BacktraceCleaner to replicate filters and silencers during duplication and cloning.

Previously, duplication still resulted in shared internal silencers and filters arrays, leading to state leakage.

Ensure necessary options are added to association options

Noting the typo in :through, take the following code sample as an example:

class User < ApplicationRecord
    has_many :courses
    has_many :assignments, trough: :courses
end


You’d get a misleading error along the lines of

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors (ArgumentError)”,

with this pull request, you’ll now get a clearer message, more like:

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors, :through (ArgumentError)”.

Note that in the second error message :through is included in the list of valid options.

Retry known idempotent SELECT queries on connection-related exceptions
Implements a mechanism to automatically retry SELECT queries that are known to be idempotent in the event of connection-related exceptions.

Queries constructed through Arel tree traversal or based on known model attributes are inherently idempotent and can be safely retried upon encountering a connection error. Previously, certain adapters like TrilogyAdapter would raise ActiveRecord::ConnectionFailed: Trilogy::EOFError when faced with a connection error during a request.

We had 22 contributors to the Rails codebase this past week!

Take care.

Your weekly inside scoop of interesting commits, pull requests and more from Rails.

Subscribe to get these updates mailed to you.
[/content]

Author: Emmanuel Hayford
PublishedDate: 2024-03-29
Category: Technology
NewsPaper: Ruby on Rails
Tags: news
{"id"=>3198,
"title"=>"Retry known idempotent SELECT queries, New Active Record configuration option, and more!",
"summary"=>"Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.   Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:",
"content"=>"

Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.\n \nTwo new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:

\n\n\n\n

Add config.active_record.permanent_connection_checkout setting\nThis setting determines the action taken when ActiveRecord::Base.connection is accessed: whether it raises an error, emits a deprecation warning, or does nothing.

\n\n

ActiveRecord::Base.connection acquires a database connection from the pool and maintains it until the request or job concludes. However, this behaviour may prove undesirable in environments with more threads or fibers than available connections.

\n\n

This configuration facilitates the identification and elimination of code utilising ActiveRecord::Base.connection, encouraging migration to ActiveRecord::Base.with_connection instead. The default behaviour remains unaltered.

\n\n

Make ActiveSupport::BacktraceCleaner copy filters on dup\nEnhance ActiveSupport::BacktraceCleaner to replicate filters and silencers during duplication and cloning.

\n\n

Previously, duplication still resulted in shared internal silencers and filters arrays, leading to state leakage.

\n\n

Ensure necessary options are added to association options

\n\n

Noting the typo in :through, take the following code sample as an example:

\n\n
class User < ApplicationRecord\n    has_many :courses\n    has_many :assignments, trough: :courses\nend\n
\n\n

You’d get a misleading error along the lines of

\n\n

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors (ArgumentError)”,

\n\n

with this pull request, you’ll now get a clearer message, more like:

\n\n

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors, :through (ArgumentError)”.

\n\n

Note that in the second error message :through is included in the list of valid options.

\n\n

Retry known idempotent SELECT queries on connection-related exceptions\nImplements a mechanism to automatically retry SELECT queries that are known to be idempotent in the event of connection-related exceptions.

\n\n

Queries constructed through Arel tree traversal or based on known model attributes are inherently idempotent and can be safely retried upon encountering a connection error. Previously, certain adapters like TrilogyAdapter would raise ActiveRecord::ConnectionFailed: Trilogy::EOFError when faced with a connection error during a request.

\n\n

We had 22 contributors to the Rails codebase this past week!

\n\n

Take care.

\n\n

Your weekly inside scoop of interesting commits, pull requests and more from Rails.

\n\n

Subscribe to get these updates mailed to you.

",
"author"=>"Emmanuel Hayford",
"link"=>"https://rubyonrails.org/2024/3/29/this-week-in-rails-retry-known-idempotent-select-queries-new-active-record-configuration-option-and-more-b3dfc401",
"published_date"=>Fri, 29 Mar 2024 00:00:00.000000000 UTC +00:00,
"image_url"=>nil,
"feed_url"=>"https://rubyonrails.org/2024/3/29/this-week-in-rails-retry-known-idempotent-select-queries-new-active-record-configuration-option-and-more-b3dfc401",
"language"=>nil,
"active"=>true,
"ricc_source"=>"feedjira::v1",
"created_at"=>Wed, 03 Apr 2024 14:31:21.812745000 UTC +00:00,
"updated_at"=>Tue, 14 May 2024 04:41:58.822970000 UTC +00:00,
"newspaper"=>"Ruby on Rails",
"macro_region"=>"Technology"}
Edit this article
Back to articles