graphql 2.1.9 → 2.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/dataloader/source.rb +1 -1
- data/lib/graphql/dataloader.rb +34 -44
- data/lib/graphql/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: aa975ca1c39b6de261e95d5b4e44f4d65cf3a52d5abeca978a03cb617732c709
|
4
|
+
data.tar.gz: ca123726f134ec05b94176591c0770eb46c4bc2b85202ab90905c2394d3269a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18c0b1dbdee834116c64174db429d25176a84dd6cc076c64969995e00b6caa9e8c1fae1f5cdf27b703091515829ac5c2743db3088bb6b290fb1c294ba56c82fb
|
7
|
+
data.tar.gz: b10c8bdb7fb16fbe289542e08237d281bd57a40885aa7176c261f564c32a1250ffe2e94ef767502079f91938c51db059c382fc2ae4c1badebcc9a90746fd85ff
|
data/lib/graphql/dataloader.rb
CHANGED
@@ -118,12 +118,7 @@ module GraphQL
|
|
118
118
|
#
|
119
119
|
# @return [void]
|
120
120
|
def yield
|
121
|
-
|
122
|
-
Fiber.yield
|
123
|
-
else
|
124
|
-
parent_fiber = Thread.current[:parent_fiber]
|
125
|
-
parent_fiber.transfer
|
126
|
-
end
|
121
|
+
Fiber.yield
|
127
122
|
nil
|
128
123
|
end
|
129
124
|
|
@@ -168,7 +163,11 @@ module GraphQL
|
|
168
163
|
ensure
|
169
164
|
@pending_jobs = prev_queue
|
170
165
|
prev_pending_keys.each do |source_instance, pending|
|
171
|
-
|
166
|
+
pending.each do |key, value|
|
167
|
+
if !source_instance.results.key?(key)
|
168
|
+
source_instance.pending[key] = value
|
169
|
+
end
|
170
|
+
end
|
172
171
|
end
|
173
172
|
end
|
174
173
|
|
@@ -178,62 +177,62 @@ module GraphQL
|
|
178
177
|
source_fibers = []
|
179
178
|
next_source_fibers = []
|
180
179
|
first_pass = true
|
180
|
+
manager = spawn_fiber do
|
181
|
+
while first_pass || job_fibers.any?
|
182
|
+
first_pass = false
|
181
183
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
184
|
+
while (f = (job_fibers.shift || spawn_job_fiber))
|
185
|
+
if f.alive?
|
186
|
+
finished = run_fiber(f)
|
187
|
+
if !finished
|
188
|
+
next_job_fibers << f
|
189
|
+
end
|
190
|
+
end
|
189
191
|
end
|
190
|
-
|
191
|
-
join_queues(job_fibers, next_job_fibers)
|
192
|
+
join_queues(job_fibers, next_job_fibers)
|
192
193
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
while source_fibers.any? || @source_cache.each_value.any? { |group_sources| group_sources.each_value.any?(&:pending?) }
|
195
|
+
while (f = source_fibers.shift || spawn_source_fiber)
|
196
|
+
if f.alive?
|
197
|
+
finished = run_fiber(f)
|
198
|
+
if !finished
|
199
|
+
next_source_fibers << f
|
200
|
+
end
|
201
|
+
end
|
198
202
|
end
|
203
|
+
join_queues(source_fibers, next_source_fibers)
|
199
204
|
end
|
200
|
-
join_queues(source_fibers, next_source_fibers)
|
201
205
|
end
|
202
206
|
end
|
203
207
|
|
208
|
+
run_fiber(manager)
|
209
|
+
|
210
|
+
if manager.alive?
|
211
|
+
raise "Invariant: Manager fiber didn't terminate properly."
|
212
|
+
end
|
213
|
+
|
204
214
|
if job_fibers.any?
|
205
215
|
raise "Invariant: job fibers should have exited but #{job_fibers.size} remained"
|
206
216
|
end
|
207
217
|
if source_fibers.any?
|
208
218
|
raise "Invariant: source fibers should have exited but #{source_fibers.size} remained"
|
209
219
|
end
|
210
|
-
|
211
220
|
rescue UncaughtThrowError => e
|
212
221
|
throw e.tag, e.value
|
213
222
|
end
|
214
223
|
|
215
224
|
def run_fiber(f)
|
216
|
-
|
217
|
-
f.resume
|
218
|
-
else
|
219
|
-
f.transfer
|
220
|
-
end
|
225
|
+
f.resume
|
221
226
|
end
|
222
227
|
|
223
228
|
def spawn_fiber
|
224
229
|
fiber_vars = get_fiber_variables
|
225
|
-
parent_fiber = use_fiber_resume? ? nil : Fiber.current
|
226
230
|
Fiber.new(blocking: !@nonblocking) {
|
227
231
|
set_fiber_variables(fiber_vars)
|
228
|
-
Thread.current[:parent_fiber] = parent_fiber
|
229
232
|
yield
|
230
233
|
# With `.transfer`, you have to explicitly pass back to the parent --
|
231
234
|
# if the fiber is allowed to terminate normally, control is passed to the main fiber instead.
|
232
|
-
|
233
|
-
parent_fiber.transfer(true)
|
234
|
-
else
|
235
|
-
true
|
236
|
-
end
|
235
|
+
true
|
237
236
|
}
|
238
237
|
end
|
239
238
|
|
@@ -245,15 +244,6 @@ module GraphQL
|
|
245
244
|
new_queue.clear
|
246
245
|
end
|
247
246
|
|
248
|
-
def use_fiber_resume?
|
249
|
-
Fiber.respond_to?(:scheduler) &&
|
250
|
-
(
|
251
|
-
(defined?(::DummyScheduler) && Fiber.scheduler.is_a?(::DummyScheduler)) ||
|
252
|
-
(defined?(::Evt) && ::Evt::Scheduler.singleton_class::BACKENDS.any? { |be| Fiber.scheduler.is_a?(be) }) ||
|
253
|
-
(defined?(::Libev) && Fiber.scheduler.is_a?(::Libev::Scheduler))
|
254
|
-
)
|
255
|
-
end
|
256
|
-
|
257
247
|
def spawn_job_fiber
|
258
248
|
if @pending_jobs.any?
|
259
249
|
spawn_fiber do
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|