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 +4 -4
- data/lib/deep_preloader.rb +5 -5
- data/lib/deep_preloader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92fe99d9c1c0a4b426c9827491057c3604e5b511c61c749701de5c65da7d4825
|
4
|
+
data.tar.gz: efab30b69e968a8a6f45e000da724189808a91dfedb6279930daeb0058ab3557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fed23d8d1df1c47f8665298594adf7741243551f207462eabd74e64e86ead26a977ec39df17d791c0c88f09b22e1958d6120b65820c14b51b313b0cc29e0d7c
|
7
|
+
data.tar.gz: a94f34a7290e83b7f26cbbcdba8ad51445bfd9f1474e2d9ba8f01449196b51a8e44789c8d81114c91a7e647af194331002fe1a1e48c9dedcfab1999ef9fdfc16
|
data/lib/deep_preloader.rb
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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!
|
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.
|
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-
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|