prosopite 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d84ad4584f5e902c5bdf39af36751bc3606db38250c86eb77a3b29123f77462c
4
- data.tar.gz: 4c467310072a1ac5c20f43efd3326505d539a599408c66bd85c5a8e590a49667
3
+ metadata.gz: 0fa7674935ab767fc5eb216492948abd724d07b2a720d345a6da361a51e80efe
4
+ data.tar.gz: 23b72eae523301b0b95d244577a019a266420fb4dc1560751b965ad6c57ea517
5
5
  SHA512:
6
- metadata.gz: 8c0dec8a51eba21315ee1e35dc775d08a1ea47f9ca4b78ac29325bff289306d35023218ae0774106bbcdfd0e1758c1c7a6ebec65c79f6b71b70fc46ded5affc5
7
- data.tar.gz: 8e09ccbc95e81392a323dfd19c3837ffef541bf03cf801ab1d58413736ac4489478d5433d892c99c036b6f64175c4c760c1f907fc3d67affd7fd828ed494500b
6
+ metadata.gz: 804e8468b23f1a6e3911a28932fb643d67aa2a5a9dc0d55662307b9ce8f412ff60c5ed3a0aded37bfa17f5dd6634f121132758f3997555147495f5ceed2a9beb
7
+ data.tar.gz: 120685a04d3a23e45b5cb6b14a8b544e40aeec4329e750156df91b3c42f4b51ce71ab1a26d28f9fb6334656a694337a58da51fa848ee46ea8341c2135e9c0b73
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prosopite (2.1.1)
4
+ prosopite (2.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prosopite
4
- VERSION = "2.1.1"
4
+ VERSION = "2.1.2"
5
5
  end
data/lib/prosopite.rb CHANGED
@@ -146,7 +146,7 @@ module Prosopite
146
146
 
147
147
  next unless queries.any?
148
148
 
149
- kaller = tc[:prosopite_query_caller][location_key]
149
+ kaller = tc[:prosopite_query_caller][location_key].map(&:to_s)
150
150
  allow_list = (@allow_stack_paths + DEFAULT_ALLOW_LIST)
151
151
  is_allowed = kaller.any? { |f| allow_list.any? { |s| f.match?(s) } }
152
152
 
@@ -160,12 +160,7 @@ module Prosopite
160
160
  end
161
161
 
162
162
  def fingerprint(query)
163
- conn = if ActiveRecord::Base.respond_to?(:lease_connection)
164
- ActiveRecord::Base.lease_connection
165
- else
166
- ActiveRecord::Base.connection
167
- end
168
- db_adapter = conn.adapter_name.downcase
163
+ db_adapter = ActiveRecord::Base.connection_db_config.adapter
169
164
  if db_adapter.include?('mysql') || db_adapter.include?('trilogy')
170
165
  mysql_fingerprint(query)
171
166
  else
@@ -281,14 +276,20 @@ module Prosopite
281
276
  sql, name = data[:sql], data[:name]
282
277
 
283
278
  if scan? && name != "SCHEMA" && sql.include?('SELECT') && data[:cached].nil? && !ignore_query?(sql)
284
- query_caller = caller
285
- location_key = Digest::SHA256.hexdigest(query_caller.hash.to_s)
279
+ query_caller = caller_locations
280
+ # Calculate the location key with as few allocations as possible
281
+ location_key = [].tap do |array|
282
+ query_caller.each do |loc|
283
+ array << loc.path
284
+ array << loc.lineno
285
+ end
286
+ end.hash
286
287
 
287
288
  tc[:prosopite_query_counter][location_key] += 1
288
289
  tc[:prosopite_query_holder][location_key] << sql
289
290
 
290
291
  if tc[:prosopite_query_counter][location_key] > 1
291
- tc[:prosopite_query_caller][location_key] = query_caller.dup
292
+ tc[:prosopite_query_caller][location_key] = query_caller
292
293
  end
293
294
  end
294
295
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prosopite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mpampis Kostas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-04 00:00:00.000000000 Z
11
+ date: 2025-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -133,7 +133,7 @@ licenses:
133
133
  metadata:
134
134
  homepage_uri: https://github.com/charkost/prosopite
135
135
  source_code_uri: https://github.com/charkost/prosopite
136
- post_install_message:
136
+ post_install_message:
137
137
  rdoc_options: []
138
138
  require_paths:
139
139
  - lib
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubygems_version: 3.5.3
152
- signing_key:
152
+ signing_key:
153
153
  specification_version: 4
154
154
  summary: N+1 auto-detection for Rails with zero false positives / false negatives
155
155
  test_files: []