oso-cloud 1.3.0.dev.3 → 1.3.0.dev.5

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: 75c0b57a46025c665c2098566134bbdc8e9e5a577706b6efc318b35a7a60ca57
4
- data.tar.gz: c6482fd3885bb7736c95ec2cf744b6f9b8111da1f9daf62c9ff56fd5636d475e
3
+ metadata.gz: 51dc4187ef8812ede5669c392262eceb0cf09ed962831f0263c0eb931703ba21
4
+ data.tar.gz: 37f0a58b35e23da57458685ad36a9171e20c933fa90a80685226ef0d3a9b9cf6
5
5
  SHA512:
6
- metadata.gz: a0f41beb06adcdc1fdefeaefedb705d45b128c4a40533ba8356922e7903acddd566a481ac1a15910eb9aaeddc904b7091ef13e0023618cdca343c74b74ab7214
7
- data.tar.gz: 027de9f7060481d03b7da46a837525d39391e130fb247dc140e7b0f7cf8db43e017da000ce6a02c4cb19032783e5888d5d36e92b90e1a618fe5324ffb955dab9
6
+ metadata.gz: 732ec34bb79ad29287de13c6e6d696e374b21478dd4943059d0b7e4adb41ff96d31908b339e69f346bc7ee64704bdaeca1973ffdb49ae088dd73991615da43b8
7
+ data.tar.gz: a397403259a48af1d934cefe3563c0a5816810b00a213e30f99aabaa41affacfa95e276c234da9201f36474ddca0305d83969816ca2ea5021eb862e2b717b579
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oso-cloud (1.3.0.dev.2)
4
+ oso-cloud (1.3.0.dev.5)
5
5
  faraday (~> 2.5.2)
6
+ faraday-net_http_persistent (~> 2.0)
6
7
  faraday-retry (~> 2.0.0)
7
8
  faraday-typhoeus (~> 1.0.0)
8
9
 
@@ -12,6 +13,7 @@ GEM
12
13
  binding_of_caller (1.0.0)
13
14
  debug_inspector (>= 0.0.1)
14
15
  coderay (1.1.3)
16
+ connection_pool (2.4.1)
15
17
  debug_inspector (1.1.0)
16
18
  ethon (0.16.0)
17
19
  ffi (>= 1.15.0)
@@ -19,15 +21,20 @@ GEM
19
21
  faraday-net_http (>= 2.0, < 3.1)
20
22
  ruby2_keywords (>= 0.0.4)
21
23
  faraday-net_http (3.0.2)
24
+ faraday-net_http_persistent (2.1.0)
25
+ faraday (~> 2.5)
26
+ net-http-persistent (~> 4.0)
22
27
  faraday-retry (2.0.0)
23
28
  faraday (~> 2.0)
24
29
  faraday-typhoeus (1.0.0)
25
30
  faraday (~> 2.0)
26
31
  typhoeus (~> 1.4)
27
- ffi (1.15.5)
32
+ ffi (1.16.2)
28
33
  interception (0.5)
29
34
  method_source (1.0.0)
30
35
  minitest (5.18.0)
36
+ net-http-persistent (4.0.2)
37
+ connection_pool (~> 2.2)
31
38
  pry (0.14.2)
32
39
  coderay (~> 1.1)
33
40
  method_source (~> 1.0)
data/lib/oso/api.rb CHANGED
@@ -3,6 +3,7 @@ require 'uri'
3
3
  require 'faraday'
4
4
  require 'faraday/retry'
5
5
  require 'faraday/typhoeus'
6
+ require 'faraday/net_http_persistent'
6
7
 
7
8
  require 'oso/helpers'
8
9
  require 'oso/version'
@@ -230,7 +231,7 @@ module OsoCloud
230
231
  /api/actions
231
232
  /api/query
232
233
  ].include? env.url.path
233
- }
234
+ },
234
235
  }
235
236
 
236
237
  if options && options[:test_adapter]
@@ -245,13 +246,10 @@ module OsoCloud
245
246
  options[:test_adapter][:func].call
246
247
  end
247
248
  end
249
+ elsif options && options[:parallel_adapter]
250
+ faraday.adapter :typhoeus, forbid_reuse: false, maxredirs: 1, connecttimeout: 30
248
251
  else
249
- # faraday.adapter :net_http
250
- # faraday.adapter :net_http_persistent, pool_size: 5 do |http|
251
- # # yields Net::HTTP::Persistent
252
- # http.idle_timeout = 1000
253
- # end
254
- faraday.adapter :typhoeus, forbid_reuse: true, maxredirs: 1
252
+ faraday.adapter :net_http_persistent, pool_size: 10, idle_timeout: 30
255
253
  end
256
254
  end
257
255
  end
@@ -259,6 +257,7 @@ module OsoCloud
259
257
  def initialize(url: 'https://api.osohq.com', api_key: nil, options: nil)
260
258
  @url = url
261
259
  @connection = get_connection(options: options)
260
+ @parallel_connection = get_connection(options: { parallel_adapter: true })
262
261
  @api_key = api_key
263
262
  @user_agent = "Oso Cloud (ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}; rv:#{VERSION})"
264
263
  @last_offset = nil
@@ -396,9 +395,10 @@ module OsoCloud
396
395
  end
397
396
 
398
397
  def POST_BATCH(path, params, body_array, isMutation)
399
- connection = get_connection(options: nil)
400
- responses = connection.in_parallel do
401
- body_array.map do |body|
398
+ connection = @parallel_connection
399
+ responses = []
400
+ connection.in_parallel do
401
+ responses = body_array.map do |body|
402
402
  connection.post("api#{path}") do |req|
403
403
  req.params = params unless params.nil?
404
404
  req.body = OsoCloud::Helpers.to_hash(body) unless body.nil?
data/lib/oso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OsoCloud
2
- VERSION = '1.3.0.dev.3'.freeze
2
+ VERSION = '1.3.0.dev.5'.freeze
3
3
  end
data/oso-cloud.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'faraday', '~> 2.5.2'
24
24
  spec.add_dependency 'faraday-retry', '~> 2.0.0'
25
- # spec.add_dependency 'faraday-net_http_persistent', '~> 2.0'
25
+ spec.add_dependency 'faraday-net_http_persistent', '~> 2.0'
26
26
  spec.add_dependency 'faraday-typhoeus', '~> 1.0.0'
27
27
  #
28
28
  spec.add_development_dependency 'minitest', '~> 5.15'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.dev.3
4
+ version: 1.3.0.dev.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-26 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday-net_http_persistent
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: faraday-typhoeus
43
57
  requirement: !ruby/object:Gem::Requirement