deep_preloader 1.0.0 → 1.0.1

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: 60cc928760d63a608b81e43c8888d1ba827bd82fe928ee8d3ece46f06306e885
4
- data.tar.gz: 0dcec8c15e0dd6f51127ba9b8f868091ce775a67fc5585786b446ac673875b50
3
+ metadata.gz: 92fe99d9c1c0a4b426c9827491057c3604e5b511c61c749701de5c65da7d4825
4
+ data.tar.gz: efab30b69e968a8a6f45e000da724189808a91dfedb6279930daeb0058ab3557
5
5
  SHA512:
6
- metadata.gz: e96854b66b2aeda406e0f7b6da7d7a61b6de93da257b1aeb4392b7710182cdc861574871336278c743e614f47c20bc15e10251538ea3214c03a89c09c6dc3307
7
- data.tar.gz: 2aa7588b8d4ab4a2052866ef96b93a46c6f2ac0ed9c6c10aed86088b4b8a13a3d102da7734d240ac0ec33d38ed3bc4872724f44574c0c2fedc8f8b693d95f4e9
6
+ metadata.gz: 4fed23d8d1df1c47f8665298594adf7741243551f207462eabd74e64e86ead26a977ec39df17d791c0c88f09b22e1958d6120b65820c14b51b313b0cc29e0d7c
7
+ data.tar.gz: a94f34a7290e83b7f26cbbcdba8ad51445bfd9f1474e2d9ba8f01449196b51a8e44789c8d81114c91a7e647af194331002fe1a1e48c9dedcfab1999ef9fdfc16
@@ -58,13 +58,13 @@ class DeepPreloader
58
58
  def run!
59
59
  while(@worklist.present?)
60
60
  context, entries = @worklist.shift
61
- ActiveRecord::Base.logger.debug("Preloading children in context #{context}") if DEBUG
61
+ ActiveRecord::Base.logger&.debug("Preloading children in context #{context}") if DEBUG
62
62
 
63
63
  loaded_entries, unloaded_entries = entries.partition(&:loaded?)
64
64
 
65
65
  unloaded_keys = unloaded_entries.map(&:key).to_set.delete(nil)
66
66
 
67
- ActiveRecord::Base.logger.debug("Need to load children for following keys: #{unloaded_keys.to_a}") if DEBUG
67
+ ActiveRecord::Base.logger&.debug("Need to load children for following keys: #{unloaded_keys.to_a}") if DEBUG
68
68
 
69
69
  found_children = {}
70
70
 
@@ -78,12 +78,12 @@ class DeepPreloader
78
78
  found_children[entry.key] = entry.children
79
79
  end
80
80
  end
81
- ActiveRecord::Base.logger.debug("found loaded children for keys #{found_children.keys}") if DEBUG
81
+ ActiveRecord::Base.logger&.debug("found loaded children for keys #{found_children.keys}") if DEBUG
82
82
  end
83
83
 
84
84
  if unloaded_keys.present?
85
85
  fetched_children = context.load_children(unloaded_keys.to_a, lock: @lock)
86
- ActiveRecord::Base.logger.debug("fetched children for keys #{fetched_children.keys}") if DEBUG
86
+ ActiveRecord::Base.logger&.debug("fetched children for keys #{fetched_children.keys}") if DEBUG
87
87
  found_children.merge!(fetched_children)
88
88
  end
89
89
 
@@ -247,7 +247,7 @@ class DeepPreloader
247
247
  target = targets.first
248
248
  end
249
249
 
250
- ActiveRecord::Base.logger.debug("attaching children to #{model.inspect}.#{association_name}: #{targets}") if DEBUG
250
+ ActiveRecord::Base.logger&.debug("attaching children to #{model.inspect}.#{association_name}: #{targets}") if DEBUG
251
251
 
252
252
  association = model.association(association_name)
253
253
  association.loaded!
@@ -1,3 +1,3 @@
1
1
  class DeepPreloader
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_preloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iKnow Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord