selective-ruby-core 0.2.10 → 0.2.11
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/lib/selective/ruby/core/controller.rb +27 -9
- data/lib/selective/ruby/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f410f920d6ebee58d8bd5baa92a50b85acde8ea3b4bd6d22591df39d7fd2d037
|
|
4
|
+
data.tar.gz: 6139327221ff4aa47f187ab663ac60c8854f97629981ed3f6d34dc2b12c37a0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68b7dca7fd3b5388b94e0eb3218b3cbb5cffcb948a6f4110a84269c6b4ed062a40a1e282d9ecf6e101cc140732d0ecd561e34434f817f760442c7aeb76f385ba
|
|
7
|
+
data.tar.gz: 8765865c0b34d02ac2654620dcb597f56d4014e9df44eb2555917149d5526d2bdec9dbc9bea9a25026ed13a56220f29429f389105d3808747cb2ed99930db94a
|
|
@@ -29,15 +29,19 @@ module Selective
|
|
|
29
29
|
@retries = 0
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# A lost connection is retried by looping here, not by calling start
|
|
33
|
+
# again from inside the rescue clause. Everything a reconnected runner
|
|
34
|
+
# does -- the rest of the run, the close, the framework's after_run
|
|
35
|
+
# hooks -- would otherwise run inside that clause, where `$!` is still
|
|
36
|
+
# the ConnectionLostError. SimpleCov's after_run hook reads that as the
|
|
37
|
+
# run having crashed and exits 1, so every CI shard whose connection
|
|
38
|
+
# dropped once failed with no failing test.
|
|
32
39
|
def start(reconnect: false)
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
loop do
|
|
41
|
+
break if connect_and_run(reconnect: reconnect)
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
run_main_loop
|
|
39
|
-
rescue ConnectionLostError
|
|
40
|
-
retry!
|
|
43
|
+
reconnect = true
|
|
44
|
+
end
|
|
41
45
|
rescue => e
|
|
42
46
|
with_error_handling { raise e }
|
|
43
47
|
end
|
|
@@ -106,7 +110,22 @@ module Selective
|
|
|
106
110
|
end
|
|
107
111
|
end
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
# One connection: true when the run finished on it, false when it was
|
|
114
|
+
# lost and the caller should reconnect.
|
|
115
|
+
def connect_and_run(reconnect:)
|
|
116
|
+
@pipe = NamedPipe.new("/tmp/#{runner_id}_2", "/tmp/#{runner_id}_1")
|
|
117
|
+
@transport_pid = spawn_transport_process(reconnect: reconnect)
|
|
118
|
+
|
|
119
|
+
handle_termination_signals(transport_pid)
|
|
120
|
+
wait_for_connectivity
|
|
121
|
+
run_main_loop
|
|
122
|
+
true
|
|
123
|
+
rescue ConnectionLostError
|
|
124
|
+
prepare_retry!
|
|
125
|
+
false
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def prepare_retry!
|
|
110
129
|
@retries += 1
|
|
111
130
|
|
|
112
131
|
with_error_handling { raise "Too many retries" } if retries > 10
|
|
@@ -116,7 +135,6 @@ module Selective
|
|
|
116
135
|
kill_transport
|
|
117
136
|
|
|
118
137
|
pipe.reset!
|
|
119
|
-
start(reconnect: true)
|
|
120
138
|
end
|
|
121
139
|
|
|
122
140
|
def write(data)
|