Skip to content

Commit

Permalink
Default to ActiveSupport::Notifications for pg and mysql2 (#583)
Browse files Browse the repository at this point in the history
background: #418

By default, rack mini profiler is expected to use active support notifications

Before
======

Oracle is working as described, but pg and mysql are not.

SqlPatches.sql_patches returns ["pg"] for postgres, patches postgres,
and does not leverage ActiveSupport::Notifications

After
=====

Like oracle, postgres and mysql are double checking with patch_rails? to determine if the
rails code should be patched.

SqlPatches.sql_patches returns [] for postgres
  • Loading branch information
kbrock committed Dec 6, 2023
1 parent a072362 commit f564b12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/patches/sql_patches.rb
Expand Up @@ -30,8 +30,8 @@ def self.patch_rails?
def self.sql_patches
patches = []

patches << 'mysql2' if defined?(Mysql2::Client) && Mysql2::Client.class == Class
patches << 'pg' if defined?(PG::Result) && PG::Result.class == Class
patches << 'mysql2' if defined?(Mysql2::Client) && Mysql2::Client.class == Class && patch_rails?
patches << 'pg' if defined?(PG::Result) && PG::Result.class == Class && patch_rails?
patches << 'oracle_enhanced' if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) && ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class == Class &&
SqlPatches.correct_version?('~> 1.5.0', ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) &&
patch_rails?
Expand Down

0 comments on commit f564b12

Please sign in to comment.