exceptional_synchrony 1.3.1 → 1.4.0.pre.1

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: aa270b85777fd65a8aae32439cb7031d28f9204e21fbfc627b7659890f47c966
4
- data.tar.gz: fea79c101de02959aefb8596b9635f2ccb24266c6173be354465b764264265ea
3
+ metadata.gz: 23aa4209588ee0dc66a1c96e25d1a524e1191f7d6f46a0acdfae90c04f19bf93
4
+ data.tar.gz: 1c40477122edb3b80bdfae312e486ef8a85cf4bac2c9ee78793e6de97bd72b5e
5
5
  SHA512:
6
- metadata.gz: ed1b737065894c49b88eeaad73f202d8e5b512b117fb36d9ea810f993d201a9999635380f0d2632978b59726c85d0682a589748d82d0fb72b9c5e7e7fd0b52c9
7
- data.tar.gz: ba46f65a0f74e86806dc40eda128b4b3172219d4c214d0ab697781334d371b7fda9f4f8e1f378d548fc7a053e01d83ea5ea747ea32266fb58ba0c81df4ada212
6
+ metadata.gz: 3fec9e8a041a72ee6c521d1ffb33eeef2a470c3df92b41dacaf7c57d6aa33fe0e3d2ee85392f68261c6ed00e29c0264f809dee303ba896bfc471682f161f2303
7
+ data.tar.gz: 04d48f19f25bcae51e5b97bf318f78c44151b3d3417dac6b536f25f7b2d778736de0b226aa80c540fbd14801c587c2ffd80e0f4c2890c2ef7003f46fb24f5add
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 2.6.5
data/CHANGELOG.md CHANGED
@@ -6,9 +6,10 @@ 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.3.1] - 2024-03-04
10
- ### Changed
11
- - Updated `exception_handling` dependency to allow usage of version 3.0
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`
12
13
 
13
14
  ## [1.3.0] - 2021-02-04
14
15
  ### Added
data/Gemfile.lock CHANGED
@@ -1,42 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exceptional_synchrony (1.3.1)
4
+ exceptional_synchrony (1.4.0.pre.1)
5
5
  em-http-request
6
6
  em-synchrony
7
7
  eventmachine
8
- exception_handling (>= 2.2)
8
+ exception_handling (~> 2.2)
9
9
  invoca-utils (~> 0.3)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (7.1.3.2)
15
- base64
16
- bigdecimal
14
+ actionmailer (6.1.1)
15
+ actionpack (= 6.1.1)
16
+ actionview (= 6.1.1)
17
+ activejob (= 6.1.1)
18
+ activesupport (= 6.1.1)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (6.1.1)
22
+ actionview (= 6.1.1)
23
+ activesupport (= 6.1.1)
24
+ rack (~> 2.0, >= 2.0.9)
25
+ rack-test (>= 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
+ actionview (6.1.1)
29
+ activesupport (= 6.1.1)
30
+ builder (~> 3.1)
31
+ erubi (~> 1.4)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
34
+ activejob (6.1.1)
35
+ activesupport (= 6.1.1)
36
+ globalid (>= 0.3.6)
37
+ activesupport (6.1.1)
17
38
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- connection_pool (>= 2.2.5)
19
- drb
20
39
  i18n (>= 1.6, < 2)
21
40
  minitest (>= 5.1)
22
- mutex_m
23
41
  tzinfo (~> 2.0)
42
+ zeitwerk (~> 2.3)
24
43
  addressable (2.7.0)
25
44
  public_suffix (>= 2.0.2, < 5.0)
26
45
  ansi (1.5.0)
27
- base64 (0.2.0)
28
- bigdecimal (3.1.6)
29
46
  builder (3.2.4)
30
47
  coderay (1.1.2)
31
- concurrent-ruby (1.2.3)
32
- connection_pool (2.4.1)
33
- contextual_logger (1.2.0)
48
+ concurrent-ruby (1.1.8)
49
+ contextual_logger (0.11.0)
34
50
  activesupport
35
51
  json
36
- cookiejar (0.3.4)
52
+ cookiejar (0.3.3)
37
53
  crack (0.4.3)
38
54
  safe_yaml (~> 1.0.0)
39
- drb (2.2.1)
55
+ crass (1.0.6)
40
56
  em-http-request (1.1.7)
41
57
  addressable (>= 2.3.4)
42
58
  cookiejar (!= 0.3.1)
@@ -47,45 +63,65 @@ GEM
47
63
  eventmachine (>= 1.0.0.beta.4)
48
64
  em-synchrony (1.0.6)
49
65
  eventmachine (>= 1.0.0.beta.1)
50
- escalate (0.3.0)
66
+ erubi (1.10.0)
51
67
  eventmachine (1.2.7)
52
- exception_handling (3.0.0)
53
- activesupport (>= 5.2)
54
- contextual_logger (~> 1.0)
55
- escalate (~> 0.3)
68
+ exception_handling (2.8.1)
69
+ actionmailer (>= 4.2, < 7.0)
70
+ actionpack (>= 4.2, < 7.0)
71
+ activesupport (>= 4.2, < 7.0)
72
+ contextual_logger (~> 0.7)
73
+ eventmachine (~> 1.0)
56
74
  invoca-utils (~> 0.3)
57
- psych (~> 3.0)
75
+ globalid (0.4.2)
76
+ activesupport (>= 4.2.0)
58
77
  hashdiff (1.0.1)
59
- http_parser.rb (0.8.0)
60
- i18n (1.14.1)
78
+ http_parser.rb (0.6.0)
79
+ i18n (1.8.8)
61
80
  concurrent-ruby (~> 1.0)
62
- invoca-utils (0.5.1)
63
- activesupport (>= 5.0)
64
- json (2.7.1)
81
+ invoca-utils (0.4.1)
82
+ json (2.5.1)
83
+ loofah (2.9.0)
84
+ crass (~> 1.0.2)
85
+ nokogiri (>= 1.5.9)
86
+ mail (2.7.1)
87
+ mini_mime (>= 0.1.1)
65
88
  method_source (1.0.0)
89
+ mini_mime (1.0.2)
90
+ mini_portile2 (2.5.0)
66
91
  minitest (5.14.0)
67
92
  minitest-reporters (1.4.2)
68
93
  ansi
69
94
  builder
70
95
  minitest (>= 5.0)
71
96
  ruby-progressbar
72
- mutex_m (0.2.0)
97
+ nokogiri (1.11.1)
98
+ mini_portile2 (~> 2.5.0)
99
+ racc (~> 1.4)
73
100
  pry (0.13.1)
74
101
  coderay (~> 1.1)
75
102
  method_source (~> 1.0)
76
- psych (3.3.4)
77
103
  public_suffix (4.0.4)
104
+ racc (1.5.2)
105
+ rack (2.2.3)
106
+ rack-test (1.1.0)
107
+ rack (>= 1.0, < 3)
108
+ rails-dom-testing (2.0.3)
109
+ activesupport (>= 4.2.0)
110
+ nokogiri (>= 1.6)
111
+ rails-html-sanitizer (1.3.0)
112
+ loofah (~> 2.3)
78
113
  rake (13.0.1)
79
114
  rr (1.2.1)
80
115
  ruby-progressbar (1.10.1)
81
116
  safe_yaml (1.0.5)
82
117
  thor (1.0.1)
83
- tzinfo (2.0.6)
118
+ tzinfo (2.0.4)
84
119
  concurrent-ruby (~> 1.0)
85
120
  webmock (1.24.6)
86
121
  addressable (>= 2.3.6)
87
122
  crack (>= 0.3.2)
88
123
  hashdiff
124
+ zeitwerk (2.4.2)
89
125
 
90
126
  PLATFORMS
91
127
  ruby
@@ -101,4 +137,4 @@ DEPENDENCIES
101
137
  webmock (~> 1.24)
102
138
 
103
139
  BUNDLED WITH
104
- 2.3.22
140
+ 1.17.3
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency 'em-synchrony'
20
20
  spec.add_dependency 'em-http-request'
21
21
  spec.add_dependency 'eventmachine'
22
- spec.add_dependency 'exception_handling', '>= 2.2'
22
+ spec.add_dependency 'exception_handling', '~> 2.2'
23
23
  spec.add_dependency 'invoca-utils', '~> 0.3'
24
24
  end
@@ -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.1'
2
+ VERSION = '1.4.0.pre.1'
3
3
  end
@@ -112,7 +112,7 @@ describe ExceptionalSynchrony::EventMachineProxy do
112
112
  end
113
113
 
114
114
  it "should handle exceptions when not waiting for its block to run" do
115
- mock(ExceptionHandling).log_error(is_a(RuntimeError), "defer")
115
+ mock(ExceptionHandling).log_error(is_a(RuntimeError), "defer", {})
116
116
 
117
117
  @em.run do
118
118
  assert_nil @em.defer("#defer success", wait_for_result: false) { raise RuntimeError, "error in defer" }
@@ -140,24 +140,45 @@ describe ExceptionalSynchrony::EventMachineProxy do
140
140
  end
141
141
 
142
142
  it "add_timer" do
143
- mock(ExceptionHandling).log_error(EXCEPTION, "add_timer")
143
+ mock(ExceptionHandling).log_error(EXCEPTION, "add_timer", {})
144
144
  mock(EventMachine::Synchrony).add_timer(10) { |duration, *args| args.first.call }
145
145
  @em.add_timer(10) { raise EXCEPTION }
146
146
  end
147
147
 
148
148
  it "add_periodic_timer" do
149
- mock(ExceptionHandling).log_error(EXCEPTION, "add_periodic_timer")
149
+ mock(ExceptionHandling).log_error(EXCEPTION, "add_periodic_timer", {})
150
150
  mock(EventMachine::Synchrony).add_periodic_timer(10) { |duration, *args| args.first.call }
151
151
  @em.add_periodic_timer(10) { raise EXCEPTION }
152
152
  end
153
153
 
154
154
  it "next_tick" do
155
- mock(ExceptionHandling).log_error(EXCEPTION, "next_tick")
155
+ mock(ExceptionHandling).log_error(EXCEPTION, "next_tick", {})
156
156
  mock(EventMachine::Synchrony).next_tick { |*args| args.first.call }
157
157
  @em.next_tick { raise EXCEPTION }
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
@@ -189,7 +210,7 @@ describe ExceptionalSynchrony::EventMachineProxy do
189
210
 
190
211
  describe "when using #{method} and on_error = :log" do
191
212
  it "should rescue any exceptions and log them" do
192
- mock(ExceptionHandling).log_error(EXCEPTION, "run_with_error_logging")
213
+ mock(ExceptionHandling).log_error(EXCEPTION, "run_with_error_logging", {})
193
214
 
194
215
  @proxy.run(on_error: :log) { raise EXCEPTION }
195
216
  end
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.1
4
+ version: 1.4.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: exception_handling
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.2'
69
69
  - !ruby/object:Gem::Dependency
@@ -126,11 +126,11 @@ 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
- rubygems_version: 3.1.6
133
+ rubygems_version: 3.0.3
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Extensions to EventMachine/Synchrony to work well with exceptions