@@ -65,11 +65,9 @@ def initialize(nonblocking: self.class.default_nonblocking, fiber_limit: self.cl
65
65
@nonblocking = nonblocking
66
66
end
67
67
@fiber_limit = fiber_limit
68
- @lazies_at_depth = nil
68
+ @lazies_at_depth = Hash . new { | h , k | h [ k ] = [ ] }
69
69
end
70
70
71
- attr_accessor :lazies_at_depth
72
-
73
71
# @return [Integer, nil]
74
72
attr_reader :fiber_limit
75
73
@@ -164,6 +162,8 @@ def clear_cache
164
162
def run_isolated
165
163
prev_queue = @pending_jobs
166
164
prev_pending_keys = { }
165
+ prev_lazies_at_depth = @lazies_at_depth
166
+ @lazies_at_depth = @lazies_at_depth . dup . clear
167
167
@source_cache . each do |source_class , batched_sources |
168
168
batched_sources . each do |batch_args , batched_source_instance |
169
169
if batched_source_instance . pending?
@@ -183,6 +183,7 @@ def run_isolated
183
183
res
184
184
ensure
185
185
@pending_jobs = prev_queue
186
+ @lazies_at_depth = prev_lazies_at_depth
186
187
prev_pending_keys . each do |source_instance , pending |
187
188
pending . each do |key , value |
188
189
if !source_instance . results . key? ( key )
@@ -194,8 +195,6 @@ def run_isolated
194
195
195
196
# @param trace_query_lazy [nil, Execution::Multiplex]
196
197
def run ( trace_query_lazy : nil )
197
- # TODO unify the initialization lazies_at_depth
198
- @lazies_at_depth ||= Hash . new { |h , k | h [ k ] = [ ] }
199
198
trace = Fiber [ :__graphql_current_multiplex ] &.current_trace
200
199
jobs_fiber_limit , total_fiber_limit = calculate_fiber_limit
201
200
job_fibers = [ ]
0 commit comments