graphiti 1.6.2 → 1.6.4

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: c7e9a22a29df9a53ef4c2da7a6bb102c4407f21201440cd0888015c2442895b5
4
- data.tar.gz: 405ed0c5ee38118ef4b535bc5751dcb960630117ca9ca1706b69bb91eda6df4a
3
+ metadata.gz: 60dd55a9db78fcc197c66de85b88bd69e840462d77a679dbb76fcd41b040dbe1
4
+ data.tar.gz: e6a2cdefe4435864ea9101c94ac122d3c11ba0e85b7284f19a08f5ec4a3cee0d
5
5
  SHA512:
6
- metadata.gz: fa1bbea7813069ac8c97bacdb7d298162bc55121771974693264c81b5b85da9420aef3d3c0509e96013f9266861e6a0e8dc61853e88dcb88b7cc7c9ddf83fa99
7
- data.tar.gz: 9929dda99cd0fecbbac7939c1a161f43f20944921950cf8f4e8bb30c30251fcbf1f253364ee7fe4c7c442e4eafb7d74c6c2cb6347835f7cdbc71713c31938639
6
+ metadata.gz: 2264e0a1313762c00ffb96fbb80c60bbc7d6406e37fedc8eef0a9b813b6bc5d5ff9443ca165d2afcf7499c61f9746a0d851b699b9ec5f90ba5ca74c16932c428
7
+ data.tar.gz: 74d51069de9047b07d213c628889766d54d8e8c43812d75a433247e70bc2b027dc7735e310bd0460a36e37083c7a9306dddbeb5d15b0160987cb8f5a65daaa93
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  graphiti changelog
2
2
 
3
+ ## [1.6.4](https://github.com/graphiti-api/graphiti/compare/v1.6.3...v1.6.4) (2024-03-27)
4
+
5
+ ## [1.6.3](https://github.com/graphiti-api/graphiti/compare/v1.6.2...v1.6.3) (2024-03-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Remove thread pool executor logic until we get a better handle on what's causing thread pool hangs. refs [#469](https://github.com/graphiti-api/graphiti/issues/469) ([7941b6f](https://github.com/graphiti-api/graphiti/commit/7941b6f75ce1001b034ed6e83c148b893e9f3d99)), closes [#471](https://github.com/graphiti-api/graphiti/issues/471) [#470](https://github.com/graphiti-api/graphiti/issues/470)
11
+
3
12
  ## [1.6.2](https://github.com/graphiti-api/graphiti/compare/v1.6.1...v1.6.2) (2024-03-22)
4
13
 
5
14
 
@@ -8,20 +8,6 @@ module Graphiti
8
8
  # Defaults to false OR if classes are cached (Rails-only)
9
9
  attr_accessor :concurrency
10
10
 
11
- # This number must be considered in accordance with the database
12
- # connection pool size configured in `database.yml`. The connection
13
- # pool should be large enough to accommodate both the foreground
14
- # threads (ie. web server or job worker threads) and background
15
- # threads. For each process, Graphiti will create one global
16
- # executor that uses this many threads to sideload resources
17
- # asynchronously. Thus, the pool size should be at least
18
- # `thread_count + concurrency_max_threads + 1`. For example, if your
19
- # web server has a maximum of 3 threads, and
20
- # `concurrency_max_threads` is set to 4, then your pool size should
21
- # be at least 8.
22
- # @return [Integer] Maximum number of threads to use when fetching sideloads concurrently
23
- attr_accessor :concurrency_max_threads
24
-
25
11
  attr_accessor :respond_to
26
12
  attr_accessor :context_for_endpoint
27
13
  attr_accessor :links_on_demand
@@ -40,7 +26,6 @@ module Graphiti
40
26
  def initialize
41
27
  @raise_on_missing_sideload = true
42
28
  @concurrency = false
43
- @concurrency_max_threads = 4
44
29
  @respond_to = [:json, :jsonapi, :xml]
45
30
  @links_on_demand = false
46
31
  @pagination_links_on_demand = false
@@ -5,7 +5,7 @@ module Graphiti
5
5
 
6
6
  class_methods do
7
7
  def all(params = {}, base_scope = nil)
8
- validate!(params)
8
+ validate_request!(params)
9
9
  _all(params, {}, base_scope)
10
10
  end
11
11
 
@@ -17,7 +17,7 @@ module Graphiti
17
17
  end
18
18
 
19
19
  def find(params = {}, base_scope = nil)
20
- validate!(params)
20
+ validate_request!(params)
21
21
  _find(params, base_scope)
22
22
  end
23
23
 
@@ -38,14 +38,14 @@ module Graphiti
38
38
  end
39
39
 
40
40
  def build(params, base_scope = nil)
41
- validate!(params)
41
+ validate_request!(params)
42
42
  runner = Runner.new(self, params)
43
43
  runner.proxy(base_scope, single: true, raise_on_missing: true)
44
44
  end
45
45
 
46
46
  private
47
47
 
48
- def validate!(params)
48
+ def validate_request!(params)
49
49
  return if Graphiti.context[:graphql] || !validate_endpoints?
50
50
 
51
51
  if context&.respond_to?(:request)
@@ -74,6 +74,7 @@ module Graphiti
74
74
  end
75
75
  end
76
76
  alias_method :to_a, :data
77
+ alias_method :resolve_data, :data
77
78
 
78
79
  def meta
79
80
  @meta ||= data.respond_to?(:meta) ? data.meta : {}
@@ -136,7 +137,7 @@ module Graphiti
136
137
  end
137
138
 
138
139
  def destroy
139
- data
140
+ resolve_data
140
141
  transaction_response = @resource.transaction do
141
142
  metadata = {method: :destroy}
142
143
  model = @resource.destroy(@query.filters[:id], metadata)
@@ -154,7 +155,7 @@ module Graphiti
154
155
  end
155
156
 
156
157
  def update
157
- data
158
+ resolve_data
158
159
  save(action: :update)
159
160
  end
160
161
 
@@ -2,23 +2,6 @@ module Graphiti
2
2
  class Scope
3
3
  attr_accessor :object, :unpaginated_object
4
4
  attr_reader :pagination
5
-
6
- @@thread_pool_executor_mutex = Mutex.new
7
-
8
- def self.thread_pool_executor
9
- return @thread_pool_executor if @thread_pool_executor
10
-
11
- concurrency = Graphiti.config.concurrency_max_threads || 4
12
- @@thread_pool_executor_mutex.synchronize do
13
- @@thread_pool_executor ||= Concurrent::ThreadPoolExecutor.new(
14
- min_threads: 0,
15
- max_threads: concurrency,
16
- max_queue: concurrency * 4,
17
- fallback_policy: :caller_runs
18
- )
19
- end
20
- end
21
-
22
5
  def initialize(object, resource, query, opts = {})
23
6
  @object = object
24
7
  @resource = resource
@@ -66,7 +49,7 @@ module Graphiti
66
49
  @resource.adapter.close if concurrent
67
50
  }
68
51
  if concurrent
69
- promises << Concurrent::Promise.execute(executor: self.class.thread_pool_executor, &resolve_sideload)
52
+ promises << Concurrent::Promise.execute(&resolve_sideload)
70
53
  else
71
54
  resolve_sideload.call
72
55
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-22 00:00:00.000000000 Z
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable