switchman 3.0.15 → 3.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/switchman/shard.rb +2 -2
- data/lib/switchman/parallel.rb +25 -0
- data/lib/switchman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375c0ee6f7bf35265f46a5b5a2d5b77a60e461c84b6a7df48617e8ad6853087c
|
4
|
+
data.tar.gz: b64d5c4b02f258cb25e8f60ce2b328d9377ef1c744a3d488c1cae249d1a50266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 286d7ed35829487f57f3e3af640861563aeea66338b78485974965b600f3cc2e3d2bd169c9a826158966466e26e8bde813067e4d904e253183b4a5dd33665e6b
|
7
|
+
data.tar.gz: b62ab284455df8934811480724c92ccb9ed057541e4a36026d8925725886dd1795ea2fd81c5c22a595f1cd10f3e2516468491135fd485db437f6d12c9eca76f4
|
@@ -182,7 +182,7 @@ module Switchman
|
|
182
182
|
new_title = [short_parent_name, name].join(' ')
|
183
183
|
Process.setproctitle(new_title)
|
184
184
|
Switchman.config[:on_fork_proc]&.call
|
185
|
-
with_each_shard(subscope, classes, exception: exception, &block)
|
185
|
+
with_each_shard(subscope, classes, exception: exception, &block).map { |result| Parallel::ResultWrapper.new(result) }
|
186
186
|
rescue => e
|
187
187
|
logger.error e.full_message
|
188
188
|
Parallel::QuietExceptionWrapper.new(name, ::Parallel::ExceptionWrapper.new(e))
|
@@ -198,7 +198,7 @@ module Switchman
|
|
198
198
|
cause: errors.first.exception
|
199
199
|
end
|
200
200
|
|
201
|
-
return ret
|
201
|
+
return ret.map(&:result)
|
202
202
|
end
|
203
203
|
|
204
204
|
classes ||= []
|
data/lib/switchman/parallel.rb
CHANGED
@@ -25,6 +25,31 @@ module Switchman
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
class UndumpableResult
|
29
|
+
attr_reader :name
|
30
|
+
|
31
|
+
def initialize(result)
|
32
|
+
@name = result.inspect
|
33
|
+
end
|
34
|
+
|
35
|
+
def inspect
|
36
|
+
"#<UndumpableResult:#{name}>"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class ResultWrapper
|
41
|
+
attr_reader :result
|
42
|
+
|
43
|
+
def initialize(result)
|
44
|
+
@result =
|
45
|
+
begin
|
46
|
+
Marshal.dump(result) && result
|
47
|
+
rescue
|
48
|
+
UndumpableResult.new(result)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
28
53
|
class PrefixingIO
|
29
54
|
delegate_missing_to :@original_io
|
30
55
|
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-03-
|
13
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|