smplkit 3.0.93 → 3.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 892be2c4c6e0ddaab8b5ad36cb4248c08243c9309f45740963adbe009f3af8e4
4
- data.tar.gz: 7dcdf94dff55e949983960a66a2fb80134c34ff362e69a00af8ac7322c136b88
3
+ metadata.gz: ff36445adee57feff67e69239e762107a851b76750f8eeac79cbf9ad2dc14dd4
4
+ data.tar.gz: ff3ba7653837f651b8a43ff6997ff7f94acfbaed015c5a72161c77ec13f16a82
5
5
  SHA512:
6
- metadata.gz: 91f79728ddb170cd32dbc70b009a1efaa1360838d7863e8167a1cf4b57bedca985ff33222eb50712f5fcb388466504cf6d8ddac389924ac408324417caa3561d
7
- data.tar.gz: 3e662575d14354902eace0bc5af02abc3ebbfdc1a2debd634cd3f36cfd84e9d214f34b547819d029622e07c5ff11f11f86d989f6c3ee1453fc2321fd048119d8
6
+ metadata.gz: 4f2496762d0f10322736e9ae14b9164d68b1ccb781c6a53405bc024393b50cfb841026c50402a4a22bb841484ef1d232736cd5a9d0bd6608fac79678a5844d24
7
+ data.tar.gz: af171d9cb412cd412b01e077c257f0d7a7a80a1c0856ae3845ccc25267571493afc1aca9525febaeaf43e48c3671003f812a20c02701ff340e36883ae715fa50
@@ -23,6 +23,7 @@ module Smplkit
23
23
  cfg.scheme = URI.parse(base_url).scheme
24
24
  cfg.access_token = api_key
25
25
  cfg.timeout = timeout
26
+ HttpPool.configure(cfg)
26
27
  api_client = SmplkitGeneratedClient::Audit::ApiClient.new(cfg)
27
28
  api_client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
28
29
  # Runtime audit ops are environment-scoped: record / list / get /
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday/net_http_persistent"
4
+
5
+ module Smplkit
6
+ # Keepalive connection pooling shared by every generated client.
7
+ #
8
+ # The openapi-generator Ruby/Faraday template builds each client's Faraday
9
+ # connection with the default +net/http+ adapter. That adapter
10
+ # (faraday-net_http) drives every request through the block form of
11
+ # +Net::HTTP#start+, which opens the socket — including the TLS handshake
12
+ # for https — runs a single request, then closes the socket on block exit.
13
+ # A long-lived SDK client making many calls would therefore pay a fresh
14
+ # DNS + TCP + TLS setup on *every* call, even though the
15
+ # +Faraday::Connection+ object itself is memoized
16
+ # (+@connection_regular ||= build_connection+).
17
+ #
18
+ # We swap in the +net_http_persistent+ adapter, which holds a keepalive
19
+ # connection pool open and reuses sockets across requests. The generated
20
+ # +ApiClient#build_connection+ runs +config.configure_connection(conn)+
21
+ # *after* it sets the default adapter, and Faraday's builder lets +adapter+
22
+ # be called again to replace the previous one — so registering a
23
+ # +configure_faraday_connection+ block is enough to override the adapter
24
+ # without editing generated code (which is overwritten on regeneration).
25
+ # The memoized connection means the pool is built once per client and
26
+ # reused for its lifetime.
27
+ module HttpPool
28
+ module_function
29
+
30
+ # Register the keepalive-pooling adapter on a generated client
31
+ # +Configuration+. Returns the configuration so callers can chain.
32
+ def configure(configuration)
33
+ configuration.configure_faraday_connection do |conn|
34
+ conn.adapter :net_http_persistent
35
+ end
36
+ configuration
37
+ end
38
+ end
39
+ end
@@ -97,6 +97,7 @@ module Smplkit
97
97
  configuration.base_path = ""
98
98
  configuration.access_token = cfg.api_key
99
99
  configuration.debugging = cfg.debug
100
+ HttpPool.configure(configuration)
100
101
  generated_module::ApiClient.new(configuration).tap do |client|
101
102
  client.default_headers["User-Agent"] = "smplkit-ruby-sdk/#{Smplkit::VERSION}"
102
103
  @extra_headers&.each do |k, v|
data/lib/smplkit.rb CHANGED
@@ -37,6 +37,7 @@ end
37
37
 
38
38
  require_relative "smplkit/errors"
39
39
  require_relative "smplkit/debug"
40
+ require_relative "smplkit/http_pool"
40
41
  require_relative "smplkit/helpers"
41
42
  require_relative "smplkit/log_level"
42
43
  require_relative "smplkit/context"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.93
4
+ version: 3.0.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -111,6 +111,26 @@ dependencies:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
113
  version: '1.0'
114
+ - !ruby/object:Gem::Dependency
115
+ name: faraday-net_http_persistent
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '2.0'
121
+ - - "<"
122
+ - !ruby/object:Gem::Version
123
+ version: '3'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '2.0'
131
+ - - "<"
132
+ - !ruby/object:Gem::Version
133
+ version: '3'
114
134
  - !ruby/object:Gem::Dependency
115
135
  name: json_logic
116
136
  requirement: !ruby/object:Gem::Requirement
@@ -880,6 +900,7 @@ files:
880
900
  - lib/smplkit/flags/types.rb
881
901
  - lib/smplkit/generators/install_generator.rb
882
902
  - lib/smplkit/helpers.rb
903
+ - lib/smplkit/http_pool.rb
883
904
  - lib/smplkit/jobs/models.rb
884
905
  - lib/smplkit/log_level.rb
885
906
  - lib/smplkit/logging/adapters/base.rb