graphql-batch 0.3.2 → 0.3.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
  SHA1:
3
- metadata.gz: 0a7998f99327121197626be0735b7af3a016ca5a
4
- data.tar.gz: f4a64bc74b428f31cc331bf8c9c7399df048a341
3
+ metadata.gz: b69567be96fe5b00779872cbb3a6d1e14b3d2a28
4
+ data.tar.gz: cfc2323ef559f92884560f68713b3d9cd41a3017
5
5
  SHA512:
6
- metadata.gz: be04e6e7d48f326f2e5fdfdad8b9c3e42401f2a84e43a5bb420aa329bdf2fe5f0b25a478c2a53c3356858d49522a65d8c8a7aa7386146600fe687fc5d48001bc
7
- data.tar.gz: 123332a5424e352958781e69767cc818f9ef66c0b06397ab88ceff309bd58c93775225b99f15e806ca5e1575019dc5ac4ff56c5dfa6b81615a5ade1580047681
6
+ metadata.gz: 423111d4a94fde2835dcfea8cafa234047100d0dd2bc248362b988537ee1dc1c35c86e5924f8db3730d95b09fbb20a49c3dfa3d6e8858271d1ad060a8303e086
7
+ data.tar.gz: d31cc1b4cddb5db6d1650e51632b26f113e5414c6d9dc44916785b7a5911c0c953e9b1fd476395fea8d9eca2ad502e08a55ead3c7bec994ebdd4059284635980
@@ -3,7 +3,7 @@ module GraphQL::Batch
3
3
  class NoExecutorError < StandardError; end
4
4
 
5
5
  def self.for(*group_args)
6
- loader_key = [self].concat(group_args)
6
+ loader_key = loader_key_for(*group_args)
7
7
  executor = Executor.current
8
8
 
9
9
  unless executor
@@ -18,6 +18,10 @@ module GraphQL::Batch
18
18
  end
19
19
  end
20
20
 
21
+ def self.loader_key_for(*group_args)
22
+ [self].concat(group_args)
23
+ end
24
+
21
25
  def self.load(key)
22
26
  self.for.load(key)
23
27
  end
@@ -40,8 +44,8 @@ module GraphQL::Batch
40
44
  end
41
45
 
42
46
  def resolve #:nodoc:
47
+ return if resolved?
43
48
  load_keys = queue
44
- return if load_keys.empty?
45
49
  @queue = nil
46
50
  perform(load_keys)
47
51
  check_for_broken_promises(load_keys)
@@ -54,13 +58,16 @@ module GraphQL::Batch
54
58
  # For Promise#sync
55
59
  def wait #:nodoc:
56
60
  if executor
57
- executor.loaders.delete(loader_key)
58
61
  executor.resolve(self)
59
62
  else
60
63
  resolve
61
64
  end
62
65
  end
63
66
 
67
+ def resolved?
68
+ @queue.nil? || @queue.empty?
69
+ end
70
+
64
71
  protected
65
72
 
66
73
  # Fulfill the key with provided value, for use in #perform
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Batch
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Thacker-Smith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql