exceptional_synchrony 1.4.3 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/pipeline.yml +2 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +107 -68
- data/exceptional_synchrony.gemspec +1 -1
- data/lib/exceptional_synchrony/event_machine_proxy.rb +1 -1
- data/lib/exceptional_synchrony/version.rb +1 -1
- data/test/unit/event_machine_proxy_test.rb +29 -9
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ca2d74de17a099687d616f5c15642347fc55c61633d59e0c5b37b73cb51006d
|
4
|
+
data.tar.gz: f9fc4d71c4122a7c213e57fdbcb4a82007a7b6c542d810b5568af9cde2aa1fca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba9ce595d840b6377ec85eebe6818c9abbce57f01f36409d0c8c41e5d8730532418af278fe36ef05a2824e7f9c31bee6903dc1204e302c676c3747afa543d4d
|
7
|
+
data.tar.gz: d34d1678567d5b8d673a89be6a284432adf99de049a71bf59e675aa031e567646b0f003a227f45815dae2283ee58d65957ad78968c08c4df7f21aa77e847d11a
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @Invoca/octothorpe
|
@@ -8,13 +8,13 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby: [2.
|
11
|
+
ruby: [2.7, '3.0', 3.1]
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
14
14
|
- uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
16
16
|
ruby-version: ${{ matrix.ruby }}
|
17
|
-
bundler:
|
17
|
+
bundler: 2.2.29
|
18
18
|
bundler-cache: true
|
19
19
|
- name: Unit tests
|
20
20
|
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ 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.5] - 2024-02-29
|
10
|
+
### Changed
|
11
|
+
- Updated dependency on `exception_handling` to allow for the latest version.
|
12
|
+
|
13
|
+
## [1.4.4] - 2022-03-25
|
14
|
+
### Changed
|
15
|
+
- Default unused defer(context) argument to nil.
|
16
|
+
|
9
17
|
## [1.4.3] - 2022-03-24
|
10
18
|
### Changed
|
11
19
|
- Update exception_handling
|
@@ -41,6 +49,7 @@ All notable changes to this project will be documented in this file.
|
|
41
49
|
## [1.1.1] - 2020-05-03
|
42
50
|
- Replace hobo_support with invoca_utils
|
43
51
|
|
52
|
+
[1.4.4]: https://github.com/Invoca/exceptional_synchrony/compare/v1.4.3...v1.4.4
|
44
53
|
[1.4.3]: https://github.com/Invoca/exceptional_synchrony/compare/v1.4.2...v1.4.3
|
45
54
|
[1.4.2]: https://github.com/Invoca/exceptional_synchrony/compare/v1.4.1...v1.4.2
|
46
55
|
[1.4.1]: https://github.com/Invoca/exceptional_synchrony/compare/v1.4.0...v1.4.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,58 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
exceptional_synchrony (1.4.
|
4
|
+
exceptional_synchrony (1.4.5)
|
5
5
|
em-http-request
|
6
6
|
em-synchrony
|
7
7
|
eventmachine
|
8
|
-
exception_handling (
|
8
|
+
exception_handling (>= 2.10, < 4.0)
|
9
9
|
invoca-utils (~> 0.3)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actionmailer (
|
15
|
-
actionpack (=
|
16
|
-
actionview (=
|
17
|
-
activejob (=
|
18
|
-
activesupport (=
|
14
|
+
actionmailer (7.1.3.2)
|
15
|
+
actionpack (= 7.1.3.2)
|
16
|
+
actionview (= 7.1.3.2)
|
17
|
+
activejob (= 7.1.3.2)
|
18
|
+
activesupport (= 7.1.3.2)
|
19
19
|
mail (~> 2.5, >= 2.5.4)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
net-imap
|
21
|
+
net-pop
|
22
|
+
net-smtp
|
23
|
+
rails-dom-testing (~> 2.2)
|
24
|
+
actionpack (7.1.3.2)
|
25
|
+
actionview (= 7.1.3.2)
|
26
|
+
activesupport (= 7.1.3.2)
|
27
|
+
nokogiri (>= 1.8.5)
|
28
|
+
racc
|
29
|
+
rack (>= 2.2.4)
|
30
|
+
rack-session (>= 1.0.1)
|
25
31
|
rack-test (>= 0.6.3)
|
26
|
-
rails-dom-testing (~> 2.
|
27
|
-
rails-html-sanitizer (~> 1.
|
28
|
-
actionview (
|
29
|
-
activesupport (=
|
32
|
+
rails-dom-testing (~> 2.2)
|
33
|
+
rails-html-sanitizer (~> 1.6)
|
34
|
+
actionview (7.1.3.2)
|
35
|
+
activesupport (= 7.1.3.2)
|
30
36
|
builder (~> 3.1)
|
31
|
-
erubi (~> 1.
|
32
|
-
rails-dom-testing (~> 2.
|
33
|
-
rails-html-sanitizer (~> 1.
|
34
|
-
activejob (
|
35
|
-
activesupport (=
|
37
|
+
erubi (~> 1.11)
|
38
|
+
rails-dom-testing (~> 2.2)
|
39
|
+
rails-html-sanitizer (~> 1.6)
|
40
|
+
activejob (7.1.3.2)
|
41
|
+
activesupport (= 7.1.3.2)
|
36
42
|
globalid (>= 0.3.6)
|
37
|
-
activesupport (
|
43
|
+
activesupport (7.1.3.2)
|
44
|
+
base64
|
45
|
+
bigdecimal
|
38
46
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
47
|
+
connection_pool (>= 2.2.5)
|
48
|
+
drb
|
39
49
|
i18n (>= 1.6, < 2)
|
40
50
|
minitest (>= 5.1)
|
51
|
+
mutex_m
|
41
52
|
tzinfo (~> 2.0)
|
42
|
-
|
43
|
-
|
44
|
-
public_suffix (>= 2.0.2, < 5.0)
|
53
|
+
addressable (2.8.1)
|
54
|
+
public_suffix (>= 2.0.2, < 6.0)
|
45
55
|
ansi (1.5.0)
|
56
|
+
base64 (0.2.0)
|
57
|
+
bigdecimal (3.1.6)
|
46
58
|
builder (3.2.4)
|
47
|
-
coderay (1.1.
|
48
|
-
concurrent-ruby (1.
|
49
|
-
|
59
|
+
coderay (1.1.3)
|
60
|
+
concurrent-ruby (1.2.3)
|
61
|
+
connection_pool (2.4.1)
|
62
|
+
contextual_logger (1.2.0)
|
50
63
|
activesupport
|
51
64
|
json
|
52
|
-
cookiejar (0.3.
|
53
|
-
crack (0.4.
|
54
|
-
|
65
|
+
cookiejar (0.3.4)
|
66
|
+
crack (0.4.5)
|
67
|
+
rexml
|
55
68
|
crass (1.0.6)
|
69
|
+
date (3.3.4)
|
70
|
+
drb (2.2.0)
|
71
|
+
ruby2_keywords
|
56
72
|
em-http-request (1.1.7)
|
57
73
|
addressable (>= 2.3.4)
|
58
74
|
cookiejar (!= 0.3.1)
|
@@ -63,67 +79,89 @@ GEM
|
|
63
79
|
eventmachine (>= 1.0.0.beta.4)
|
64
80
|
em-synchrony (1.0.6)
|
65
81
|
eventmachine (>= 1.0.0.beta.1)
|
66
|
-
erubi (1.
|
82
|
+
erubi (1.12.0)
|
67
83
|
escalate (0.3.0)
|
68
84
|
eventmachine (1.2.7)
|
69
|
-
exception_handling (2.
|
70
|
-
actionmailer (>=
|
71
|
-
actionpack (>=
|
72
|
-
activesupport (>=
|
73
|
-
contextual_logger (~> 0
|
85
|
+
exception_handling (2.16.0)
|
86
|
+
actionmailer (>= 5.2)
|
87
|
+
actionpack (>= 5.2)
|
88
|
+
activesupport (>= 5.2)
|
89
|
+
contextual_logger (~> 1.0)
|
74
90
|
escalate (~> 0.3)
|
75
91
|
eventmachine (~> 1.0)
|
76
92
|
invoca-utils (~> 0.3)
|
77
|
-
|
78
|
-
|
93
|
+
net-smtp
|
94
|
+
psych (~> 3.0)
|
95
|
+
globalid (1.2.1)
|
96
|
+
activesupport (>= 6.1)
|
79
97
|
hashdiff (1.0.1)
|
80
98
|
http_parser.rb (0.8.0)
|
81
|
-
i18n (1.
|
99
|
+
i18n (1.14.1)
|
82
100
|
concurrent-ruby (~> 1.0)
|
83
|
-
invoca-utils (0.
|
84
|
-
|
85
|
-
|
101
|
+
invoca-utils (0.5.1)
|
102
|
+
activesupport (>= 5.0)
|
103
|
+
json (2.7.1)
|
104
|
+
loofah (2.22.0)
|
86
105
|
crass (~> 1.0.2)
|
87
|
-
nokogiri (>= 1.
|
88
|
-
mail (2.
|
106
|
+
nokogiri (>= 1.12.0)
|
107
|
+
mail (2.8.1)
|
89
108
|
mini_mime (>= 0.1.1)
|
109
|
+
net-imap
|
110
|
+
net-pop
|
111
|
+
net-smtp
|
90
112
|
method_source (1.0.0)
|
91
|
-
mini_mime (1.1.
|
92
|
-
mini_portile2 (2.8.
|
93
|
-
minitest (5.
|
94
|
-
minitest-reporters (1.
|
113
|
+
mini_mime (1.1.5)
|
114
|
+
mini_portile2 (2.8.5)
|
115
|
+
minitest (5.18.0)
|
116
|
+
minitest-reporters (1.6.0)
|
95
117
|
ansi
|
96
118
|
builder
|
97
119
|
minitest (>= 5.0)
|
98
120
|
ruby-progressbar
|
99
|
-
|
100
|
-
|
121
|
+
mutex_m (0.2.0)
|
122
|
+
net-imap (0.4.10)
|
123
|
+
date
|
124
|
+
net-protocol
|
125
|
+
net-pop (0.1.2)
|
126
|
+
net-protocol
|
127
|
+
net-protocol (0.2.2)
|
128
|
+
timeout
|
129
|
+
net-smtp (0.4.0.1)
|
130
|
+
net-protocol
|
131
|
+
nokogiri (1.15.5)
|
132
|
+
mini_portile2 (~> 2.8.2)
|
101
133
|
racc (~> 1.4)
|
102
|
-
pry (0.
|
134
|
+
pry (0.14.2)
|
103
135
|
coderay (~> 1.1)
|
104
136
|
method_source (~> 1.0)
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
rack
|
109
|
-
|
110
|
-
|
111
|
-
|
137
|
+
psych (3.3.4)
|
138
|
+
public_suffix (5.0.1)
|
139
|
+
racc (1.7.3)
|
140
|
+
rack (3.0.9.1)
|
141
|
+
rack-session (2.0.0)
|
142
|
+
rack (>= 3.0.0)
|
143
|
+
rack-test (2.1.0)
|
144
|
+
rack (>= 1.3)
|
145
|
+
rails-dom-testing (2.2.0)
|
146
|
+
activesupport (>= 5.0.0)
|
147
|
+
minitest
|
112
148
|
nokogiri (>= 1.6)
|
113
|
-
rails-html-sanitizer (1.
|
114
|
-
loofah (~> 2.
|
115
|
-
|
149
|
+
rails-html-sanitizer (1.6.0)
|
150
|
+
loofah (~> 2.21)
|
151
|
+
nokogiri (~> 1.14)
|
152
|
+
rake (13.0.6)
|
153
|
+
rexml (3.2.5)
|
116
154
|
rr (1.2.1)
|
117
|
-
ruby-progressbar (1.
|
118
|
-
|
119
|
-
thor (1.
|
120
|
-
|
155
|
+
ruby-progressbar (1.13.0)
|
156
|
+
ruby2_keywords (0.0.5)
|
157
|
+
thor (1.2.1)
|
158
|
+
timeout (0.4.1)
|
159
|
+
tzinfo (2.0.6)
|
121
160
|
concurrent-ruby (~> 1.0)
|
122
161
|
webmock (1.24.6)
|
123
162
|
addressable (>= 2.3.6)
|
124
163
|
crack (>= 0.3.2)
|
125
164
|
hashdiff
|
126
|
-
zeitwerk (2.5.4)
|
127
165
|
|
128
166
|
PLATFORMS
|
129
167
|
ruby
|
@@ -134,9 +172,10 @@ DEPENDENCIES
|
|
134
172
|
minitest-reporters
|
135
173
|
pry
|
136
174
|
rake
|
175
|
+
rexml
|
137
176
|
rr (~> 1.2)
|
138
177
|
thor
|
139
178
|
webmock (~> 1.24)
|
140
179
|
|
141
180
|
BUNDLED WITH
|
142
|
-
|
181
|
+
2.3.22
|
@@ -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', '
|
22
|
+
spec.add_dependency 'exception_handling', '>= 2.10', '< 4.0'
|
23
23
|
spec.add_dependency 'invoca-utils', '~> 0.3'
|
24
24
|
end
|
@@ -89,7 +89,7 @@ module ExceptionalSynchrony
|
|
89
89
|
# This method will execute the block on the background thread pool
|
90
90
|
# By default, it will block the caller until the background thread has finished, so that the result can be returned
|
91
91
|
# :wait_for_result - setting this to false will prevent the caller from being blocked by this deferred work
|
92
|
-
def defer(
|
92
|
+
def defer(_context = nil, wait_for_result: true, &block)
|
93
93
|
if wait_for_result
|
94
94
|
deferrable = EventMachine::DefaultDeferrable.new
|
95
95
|
callback = -> (result) { deferrable.succeed(result) }
|
@@ -102,7 +102,7 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
102
102
|
|
103
103
|
it "should output its block's output when it doesn't raise an error, by default" do
|
104
104
|
@em.run do
|
105
|
-
assert_equal 12, @em.defer
|
105
|
+
assert_equal 12, @em.defer { 12 }
|
106
106
|
@em.stop
|
107
107
|
end
|
108
108
|
end
|
@@ -111,7 +111,7 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
111
111
|
@block_ran = false
|
112
112
|
|
113
113
|
@em.run do
|
114
|
-
assert_nil @em.defer(
|
114
|
+
assert_nil @em.defer(wait_for_result: false) { @block_ran = true; 12 }
|
115
115
|
refute @block_ran
|
116
116
|
stop_em_after_defers_finish!(@em)
|
117
117
|
end
|
@@ -120,10 +120,14 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
it "should handle exceptions when not waiting for its block to run" do
|
123
|
-
|
123
|
+
if RUBY_VERSION < '2.7'
|
124
|
+
mock(ExceptionHandling).log_error(is_a(RuntimeError), "defer", {})
|
125
|
+
else
|
126
|
+
mock(ExceptionHandling).log_error(is_a(RuntimeError), "defer")
|
127
|
+
end
|
124
128
|
|
125
129
|
@em.run do
|
126
|
-
assert_nil @em.defer(
|
130
|
+
assert_nil @em.defer(wait_for_result: false) { raise RuntimeError, "error in defer" }
|
127
131
|
stop_em_after_defers_finish!(@em)
|
128
132
|
end
|
129
133
|
end
|
@@ -131,7 +135,7 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
131
135
|
it "should raise an error when its block raises an error" do
|
132
136
|
@em.run do
|
133
137
|
ex = assert_raises(ArgumentError) do
|
134
|
-
@em.defer
|
138
|
+
@em.defer { raise ArgumentError, "!!!" }
|
135
139
|
end
|
136
140
|
|
137
141
|
assert_equal "!!!", ex.message
|
@@ -148,19 +152,31 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
148
152
|
end
|
149
153
|
|
150
154
|
it "add_timer" do
|
151
|
-
|
155
|
+
if RUBY_VERSION < '2.7'
|
156
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "add_timer", {})
|
157
|
+
else
|
158
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "add_timer")
|
159
|
+
end
|
152
160
|
mock(EventMachine::Synchrony).add_timer(10) { |duration, *args| args.first.call }
|
153
161
|
@em.add_timer(10) { raise EXCEPTION }
|
154
162
|
end
|
155
163
|
|
156
164
|
it "add_periodic_timer" do
|
157
|
-
|
165
|
+
if RUBY_VERSION < '2.7'
|
166
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "add_periodic_timer", {})
|
167
|
+
else
|
168
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "add_periodic_timer")
|
169
|
+
end
|
158
170
|
mock(EventMachine::Synchrony).add_periodic_timer(10) { |duration, *args| args.first.call }
|
159
171
|
@em.add_periodic_timer(10) { raise EXCEPTION }
|
160
172
|
end
|
161
173
|
|
162
174
|
it "next_tick" do
|
163
|
-
|
175
|
+
if RUBY_VERSION < '2.7'
|
176
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "next_tick", {})
|
177
|
+
else
|
178
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "next_tick")
|
179
|
+
end
|
164
180
|
mock(EventMachine::Synchrony).next_tick { |*args| args.first.call }
|
165
181
|
@em.next_tick { raise EXCEPTION }
|
166
182
|
end
|
@@ -210,7 +226,11 @@ describe ExceptionalSynchrony::EventMachineProxy do
|
|
210
226
|
|
211
227
|
describe "when using #{method} and on_error = :log" do
|
212
228
|
it "should rescue any exceptions and log them" do
|
213
|
-
|
229
|
+
if RUBY_VERSION < '2.7'
|
230
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "run_with_error_logging", {})
|
231
|
+
else
|
232
|
+
mock(ExceptionHandling).log_error(EXCEPTION, "run_with_error_logging")
|
233
|
+
end
|
214
234
|
|
215
235
|
@proxy.run(on_error: :log) { raise EXCEPTION }
|
216
236
|
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.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
@@ -56,16 +56,22 @@ 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.10'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.0'
|
62
65
|
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- - "
|
69
|
+
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '2.10'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '4.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: invoca-utils
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +93,7 @@ extensions: []
|
|
87
93
|
extra_rdoc_files: []
|
88
94
|
files:
|
89
95
|
- ".dependabot/config.yml"
|
96
|
+
- ".github/CODEOWNERS"
|
90
97
|
- ".github/workflows/pipeline.yml"
|
91
98
|
- ".gitignore"
|
92
99
|
- ".ruby-gemset"
|
@@ -130,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
137
|
- !ruby/object:Gem::Version
|
131
138
|
version: '0'
|
132
139
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.1.6
|
134
141
|
signing_key:
|
135
142
|
specification_version: 4
|
136
143
|
summary: Extensions to EventMachine/Synchrony to work well with exceptions
|