frozen_record 0.25.0 → 0.25.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2be87eaecead5b4f1d4c5e941d48fcd9be163c56f2c9b988ec4d6ff7ea84757
4
- data.tar.gz: 0a4a51c609251f3a46ba49e16f85b1d27ce5e52581fb70bd605c8585b1f62fa8
3
+ metadata.gz: 55cfe5dc540e6f5aa6d4a188a45297e5daae39c67b6f79a029ed12a1333d2a17
4
+ data.tar.gz: 68ec4931e6cd4c24dc95da423b4d32f61f789ebb38e8012ad16f12db9a0d389b
5
5
  SHA512:
6
- metadata.gz: 4326747e566bdb03b700dd5bb8164b550f8d339991754cebeb2a5414f8858a4bb19c074ac2231d4e978be881ed0ff87611c107c69bbc2a21ba498b7d3eb563eb
7
- data.tar.gz: f73715f137336bada8a8aad2a3be9d6b4cf87f4de9dae6c2b77463201f7a3e510ae6c7491d9957db9c7d2b6df8280576e7e896eb8bf28b661bff02d32d4634f5
6
+ metadata.gz: a3bbf2f250846efd3679e39a7aea8628bfdea01c84a31cab342d5348e4a41bff3655a1f4e4158b461e2084866113c0a110b676664087ccb1b735c5d66e330cd3
7
+ data.tar.gz: e3bb79694ba6bb4b430cc378bad2c787a41bf71ec2834eb218d10243e0cb24d6573ef19661a454c613ede947dd33eaccc75a61395259533e2aaedb6a3089f565
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Unreleased
2
2
 
3
+ - Also disable max_records_scan when loading `Compact` records.
4
+
5
+ # v0.25.2
6
+
7
+ - Fix FrozenRecord.ignore_max_records_scan not applying
8
+
9
+ # v0.25.1
10
+
11
+ - More reliable way to disable max_records_scan checks when loading records.
12
+
3
13
  # v0.25.0
4
14
 
5
15
  - Disable max_records_scan checks when loading records.
@@ -6,6 +6,19 @@ require 'frozen_record/backends'
6
6
  module FrozenRecord
7
7
  SlowQuery = Class.new(StandardError)
8
8
 
9
+ class << self
10
+ attr_accessor :enforce_max_records_scan
11
+
12
+ def ignore_max_records_scan
13
+ previous = enforce_max_records_scan
14
+ self.enforce_max_records_scan = false
15
+ yield
16
+ ensure
17
+ self.enforce_max_records_scan = previous
18
+ end
19
+ end
20
+ @enforce_max_records_scan = true
21
+
9
22
  class Base
10
23
  extend ActiveSupport::DescendantsTracker
11
24
  extend ActiveModel::Naming
@@ -156,7 +169,7 @@ module FrozenRecord
156
169
  end
157
170
  @attributes = list_attributes(records).freeze
158
171
  define_attribute_methods(@attributes.to_a)
159
- records = with_max_records_scan(nil) { records.map { |r| load(r) }.freeze }
172
+ records = FrozenRecord.ignore_max_records_scan { records.map { |r| load(r) }.freeze }
160
173
  index_definitions.values.each { |index| index.build(records) }
161
174
  records
162
175
  end
@@ -19,7 +19,7 @@ module FrozenRecord
19
19
  @attributes = list_attributes(records).freeze
20
20
  build_attributes_cache
21
21
  define_attribute_methods(@attributes.to_a)
22
- records = records.map { |r| load(r) }.freeze
22
+ records = FrozenRecord.ignore_max_records_scan { records.map { |r| load(r) }.freeze }
23
23
  index_definitions.values.each { |index| index.build(records) }
24
24
  records
25
25
  end
@@ -202,7 +202,7 @@ module FrozenRecord
202
202
  end
203
203
  end
204
204
 
205
- if @klass.max_records_scan && records.size > @klass.max_records_scan
205
+ if FrozenRecord.enforce_max_records_scan && @klass.max_records_scan && records.size > @klass.max_records_scan
206
206
  raise SlowQuery, "Scanning #{records.size} records is too slow, the allowed maximum is #{@klass.max_records_scan}. Try to find a better index or consider an alternative storage"
207
207
  end
208
208
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FrozenRecord
4
- VERSION = '0.25.0'
4
+ VERSION = '0.25.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frozen_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.25.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier