exceptional_synchrony 1.3.0 → 1.4.0.pre.1

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: d067a2b3a9635740dbee2374a06e772c29ca9a8fe57a61108c94118ac15480bb
4
- data.tar.gz: 665f4bf8ccc1ea699c0d56a4f7d38647c2e3e64e814b736562bf83b69ccd0d25
3
+ metadata.gz: 23aa4209588ee0dc66a1c96e25d1a524e1191f7d6f46a0acdfae90c04f19bf93
4
+ data.tar.gz: 1c40477122edb3b80bdfae312e486ef8a85cf4bac2c9ee78793e6de97bd72b5e
5
5
  SHA512:
6
- metadata.gz: 9961b1ef53acfb4c94651611871b120279dab3b3564e1841b199a7b2fa1f7a3728bca945517f50964704b0491f9a086192cb857a3205c6008758ecb51a4fb9c5
7
- data.tar.gz: 0a4d64204faf45276aaca59757ad43bb850c75ea668671e92eae251721a19c6b2ce0ecae5b3bb38c8a64179ba41d0b0864bf1a6640de4e234c4c772434bcfca0
6
+ metadata.gz: 3fec9e8a041a72ee6c521d1ffb33eeef2a470c3df92b41dacaf7c57d6aa33fe0e3d2ee85392f68261c6ed00e29c0264f809dee303ba896bfc471682f161f2303
7
+ data.tar.gz: 04d48f19f25bcae51e5b97bf318f78c44151b3d3417dac6b536f25f7b2d778736de0b226aa80c540fbd14801c587c2ffd80e0f4c2890c2ef7003f46fb24f5add
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ Note: This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
6
6
 
7
7
  All notable changes to this project will be documented in this file.
8
8
 
9
+ ## [1.4.0] - UNRELEASED
10
+ ### Added
11
+ - For users of `Faraday` connections, its `default_adapter` is configured to `:em_synchrony` when starting
12
+ the `EventMachine` reactor so that the reactor does not get blocked when using `Faraday`
13
+
9
14
  ## [1.3.0] - 2021-02-04
10
15
  ### Added
11
16
  - Extend `EMP.defer` to have a new keyword argument, `wait_for_result` for the callers to control whether they should should block until the background thread returns. To preserve existing behavior, this option defaults to `true`, so `EMP.defer` will block in order to return the value (or raise an exception) from the deferred block. Callers can pass `wait_for_result: false` if they do not want to block.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exceptional_synchrony (1.3.0)
4
+ exceptional_synchrony (1.4.0.pre.1)
5
5
  em-http-request
6
6
  em-synchrony
7
7
  eventmachine
@@ -76,7 +76,7 @@ GEM
76
76
  activesupport (>= 4.2.0)
77
77
  hashdiff (1.0.1)
78
78
  http_parser.rb (0.6.0)
79
- i18n (1.8.7)
79
+ i18n (1.8.8)
80
80
  concurrent-ruby (~> 1.0)
81
81
  invoca-utils (0.4.1)
82
82
  json (2.5.1)
@@ -76,6 +76,7 @@ module ExceptionalSynchrony
76
76
  # :log - log any rescued StandardError exceptions and continue
77
77
  # :raise - raise FatalRunError for any rescued StandardError exceptions
78
78
  def run(on_error: :log, &block)
79
+ configure_faraday
79
80
  case on_error
80
81
  when :log then run_with_error_logging(&block)
81
82
  when :raise then run_with_error_raising(&block)
@@ -133,6 +134,12 @@ module ExceptionalSynchrony
133
134
 
134
135
  private
135
136
 
137
+ def configure_faraday
138
+ if defined?(Faraday)
139
+ Faraday.default_adapter = :em_synchrony
140
+ end
141
+ end
142
+
136
143
  def run_with_error_logging(&block)
137
144
  ensure_completely_safe("run_with_error_logging") do
138
145
  if @proxy_class.respond_to?(:synchrony)
@@ -1,3 +1,3 @@
1
1
  module ExceptionalSynchrony
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0.pre.1'
3
3
  end
@@ -158,6 +158,27 @@ describe ExceptionalSynchrony::EventMachineProxy do
158
158
  end
159
159
  end
160
160
 
161
+ describe "run with faraday" do
162
+ it "should conigure Faraday default_adapter to :em_synchrony if Faraday is defined" do
163
+ class Faraday
164
+ class << self
165
+ attr_reader :default_adapter
166
+
167
+ def default_adapter=(adapter)
168
+ @default_adapter = adapter
169
+ end
170
+ end
171
+
172
+ self.default_adapter = :net_http
173
+ end
174
+
175
+ mock(@em).run_with_error_logging
176
+ assert_equal :net_http, Faraday.default_adapter
177
+ @em.run
178
+ assert_equal :em_synchrony, Faraday.default_adapter
179
+ end
180
+ end
181
+
161
182
  { synchrony: SynchronyProxyMock, run: RunProxyMock }.each do |method, proxy_mock|
162
183
  describe "run" do
163
184
  before do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exceptional_synchrony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -126,9 +126,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ">"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 1.3.1
132
132
  requirements: []
133
133
  rubygems_version: 3.0.3
134
134
  signing_key: