concurrently 1.1.0 → 1.1.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 +4 -4
- data/guides/Troubleshooting.md +2 -2
- data/lib/all/concurrently/evaluation.rb +8 -2
- data/lib/all/concurrently/event_loop/run_queue.rb +1 -1
- data/lib/all/concurrently/proc/evaluation.rb +12 -2
- data/lib/all/concurrently/proc/fiber.rb +4 -4
- data/lib/all/concurrently/version.rb +1 -1
- data/lib/all/kernel.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e10c69de9f9db4d13d7411544b336709be235688
|
4
|
+
data.tar.gz: a519b852d6ac6d07689daf39bd893fe1594c76eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e81443aec073e777bb7bdb18a293383716d66028a884d773208205aae52a15f2af993ed8f427f78e4515d83b379b07ee287c3d5f1ac2f10c478267258aff2872
|
7
|
+
data.tar.gz: 87102e7ee79831c03975175f52527b78da04100d6ddaaca56e479b208f59d03a362ea5ddbf3df16f08d37bf41d5157978c222f1b3c1afbb3e920f3e3b6d7b3e2
|
data/guides/Troubleshooting.md
CHANGED
@@ -178,8 +178,8 @@ managing IOs (e.g. closing them).
|
|
178
178
|
Every evaluation rescues the following errors: `NoMemoryError`, `ScriptError`,
|
179
179
|
`SecurityError`, `StandardError` and `SystemStackError`. These are all errors
|
180
180
|
that should not have an immediate influence on other evaluations or the
|
181
|
-
application as a whole. They will not leak to the event loop
|
182
|
-
it down.
|
181
|
+
application as a whole. They will be rescued and do not leak to the event loop
|
182
|
+
and thus will not tear it down.
|
183
183
|
|
184
184
|
All other errors happening during an evaluation *will* tear down the event
|
185
185
|
loop. These error types are: `SignalException`, `SystemExit` and the general
|
@@ -35,7 +35,10 @@ module Concurrently
|
|
35
35
|
# @private
|
36
36
|
#
|
37
37
|
# The fiber the evaluation runs inside.
|
38
|
-
|
38
|
+
def __resume__(result)
|
39
|
+
@scheduled = false
|
40
|
+
@fiber.resume result
|
41
|
+
end
|
39
42
|
|
40
43
|
# @!attribute [r] waiting?
|
41
44
|
#
|
@@ -73,7 +76,7 @@ module Concurrently
|
|
73
76
|
# because of a manual call of {Kernel#await_resume!}.
|
74
77
|
#
|
75
78
|
# @return [:resumed]
|
76
|
-
# @raise [Error] if the evaluation is
|
79
|
+
# @raise [Error] if the evaluation is already scheduled to resume
|
77
80
|
#
|
78
81
|
# @example
|
79
82
|
# # Control flow is indicated by (N)
|
@@ -90,6 +93,9 @@ module Concurrently
|
|
90
93
|
# # (5)
|
91
94
|
# evaluation.await_result # => :result
|
92
95
|
def resume!(result = nil)
|
96
|
+
raise Error, "already scheduled to resume" if @scheduled
|
97
|
+
@scheduled = true
|
98
|
+
|
93
99
|
run_queue = Concurrently::EventLoop.current.run_queue
|
94
100
|
|
95
101
|
# Cancel running the fiber if it has already been scheduled to run; but
|
@@ -235,12 +235,22 @@ module Concurrently
|
|
235
235
|
@concluded = true
|
236
236
|
|
237
237
|
if Fiber.current != @fiber
|
238
|
-
# Cancel fiber by resuming it with itself as argument
|
239
|
-
@fiber.resume
|
238
|
+
# Cancel its fiber by resuming it with itself as argument
|
239
|
+
@fiber.resume Cancelled
|
240
240
|
end
|
241
241
|
|
242
242
|
@awaiting_result.each{ |evaluation, override| evaluation.resume! (override or result) }
|
243
243
|
:concluded
|
244
244
|
end
|
245
|
+
|
246
|
+
# Schedules the evaluation to be resumed
|
247
|
+
#
|
248
|
+
# For details see: {Concurrently::Evaluation#resume!}
|
249
|
+
#
|
250
|
+
# @raise [Evaluation::Error] if the evaluation is already concluded
|
251
|
+
def resume!(*)
|
252
|
+
raise Evaluation::Error, "already concluded to #{@result.inspect}" if @concluded
|
253
|
+
super
|
254
|
+
end
|
245
255
|
end
|
246
256
|
end
|
@@ -20,7 +20,7 @@ module Concurrently
|
|
20
20
|
while true
|
21
21
|
evaluation_bucket ||= EMPTY_EVALUATION_BUCKET
|
22
22
|
|
23
|
-
result = if proc
|
23
|
+
result = if proc.equal? Proc::Evaluation::Cancelled
|
24
24
|
# If we are given this very fiber when starting itself it means it
|
25
25
|
# has been evaluated right before its start. In this case just
|
26
26
|
# yield back to the evaluating fiber.
|
@@ -31,9 +31,9 @@ module Concurrently
|
|
31
31
|
|
32
32
|
:cancelled
|
33
33
|
elsif not Proc === proc
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
raise Concurrently::Error, "Concurrent evaluation not started " <<
|
35
|
+
"properly. This should never happen and if it does it means " <<
|
36
|
+
"there is a bug in Concurrently."
|
37
37
|
else
|
38
38
|
begin
|
39
39
|
result = proc.__proc_call__ *args
|
data/lib/all/kernel.rb
CHANGED
@@ -131,13 +131,11 @@ module Kernel
|
|
131
131
|
end
|
132
132
|
evaluation.instance_variable_set :@waiting, false
|
133
133
|
|
134
|
-
|
135
|
-
# prematurely.
|
136
|
-
if evaluation.fiber == result
|
134
|
+
if Concurrently::Proc::Evaluation::Cancelled.equal? result
|
137
135
|
run_queue.cancel evaluation # in case the evaluation has already been scheduled to resume
|
138
136
|
raise Concurrently::Proc::Evaluation::Cancelled, ''
|
139
|
-
elsif Concurrently::Evaluation::TimeoutError
|
140
|
-
raise
|
137
|
+
elsif Concurrently::Evaluation::TimeoutError.equal? result
|
138
|
+
raise Concurrently::Evaluation::TimeoutError, "evaluation timed out after #{seconds} second(s)"
|
141
139
|
else
|
142
140
|
result
|
143
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrently
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Aue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nio4r
|