cdc-parallel 0.2.1 → 0.2.2
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/CHANGELOG.md +15 -0
- data/lib/cdc/parallel/processor_pool.rb +27 -1
- data/lib/cdc/parallel/transaction_pool.rb +6 -2
- data/lib/cdc/parallel/version.rb +1 -1
- data/sig/cdc/parallel/processor_pool.rbs +6 -0
- data/sig/shims/cdc_core.rbs +2 -2
- 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: a51d304d55079509a1c2056573a9f4764924573b9a13eb1dbeda89ac94d57836
|
|
4
|
+
data.tar.gz: 4e154536aaca3d801d4affe02e424f332c6a1a37b738ee70cc8fea5f335645fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3002bfcd3914510fc39e7621fba99a7868303d24f8c8e5b849d40c653f73355b9926636ed6bb31754f2f028d65af325207eb89466923bc413eb8e44538730e7
|
|
7
|
+
data.tar.gz: 686ef1d6c0759d8ebedbd18e7109a4ac22008e8a0501faab31db8440bef3cf1127f79b076ce46fd3d8eec46f6e524e0ac6a75b1d3e0cefbc2f5ab151e99110b8
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
|
|
6
6
|
|
|
7
|
+
## [0.2.2] - 2026-06-03
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Improved processor pool shutdown so workers are signaled and confirmed stopped where practical.
|
|
12
|
+
- Updated transaction processing so partial event failures fail the transaction result while preserving per-event results.
|
|
13
|
+
- Added CI validation for RBS signatures.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added regression coverage for shutdown after processed and pending work.
|
|
18
|
+
- Added regression coverage for timeout-bounded shutdown behavior.
|
|
19
|
+
- Added regression coverage for `process_many([])` returning a clean empty result.
|
|
20
|
+
- Added transaction pool coverage for successful and partially failed transactions.
|
|
21
|
+
|
|
7
22
|
## [0.2.1] - 2026-06-03
|
|
8
23
|
|
|
9
24
|
### Added
|
|
@@ -63,6 +63,13 @@ module CDC
|
|
|
63
63
|
|
|
64
64
|
@shutdown = true
|
|
65
65
|
|
|
66
|
+
signal_workers
|
|
67
|
+
wait_for_workers
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def signal_workers
|
|
66
73
|
@workers.each do |worker|
|
|
67
74
|
worker.send(nil)
|
|
68
75
|
rescue Ractor::ClosedError
|
|
@@ -70,7 +77,26 @@ module CDC
|
|
|
70
77
|
end
|
|
71
78
|
end
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
def wait_for_workers
|
|
81
|
+
if @configuration.timeout
|
|
82
|
+
wait_for_workers_with_timeout
|
|
83
|
+
else
|
|
84
|
+
@workers.each(&:join)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def wait_for_workers_with_timeout
|
|
89
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + @configuration.timeout
|
|
90
|
+
|
|
91
|
+
@workers.each do |worker|
|
|
92
|
+
remaining = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
93
|
+
break unless remaining.positive?
|
|
94
|
+
|
|
95
|
+
::Timeout.timeout(remaining, TimeoutError) { worker.join }
|
|
96
|
+
rescue TimeoutError
|
|
97
|
+
break
|
|
98
|
+
end
|
|
99
|
+
end
|
|
74
100
|
|
|
75
101
|
def validate_processor!(processor)
|
|
76
102
|
return if processor.class.respond_to?(:ractor_safe?) &&
|
|
@@ -16,8 +16,12 @@ module CDC
|
|
|
16
16
|
# @param transaction [CDC::Core::TransactionEnvelope]
|
|
17
17
|
# @return [CDC::Core::ProcessorResult]
|
|
18
18
|
def process(transaction)
|
|
19
|
-
results =
|
|
20
|
-
|
|
19
|
+
results = @processor_pool.process_many(transaction.events).freeze
|
|
20
|
+
failure = results.find(&:failure?)
|
|
21
|
+
|
|
22
|
+
return CDC::Core::ProcessorResult.failure(failure.error, event: results) if failure
|
|
23
|
+
|
|
24
|
+
CDC::Core::ProcessorResult.success(results)
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
# Shut down worker resources.
|
data/lib/cdc/parallel/version.rb
CHANGED
|
@@ -37,6 +37,12 @@ module CDC
|
|
|
37
37
|
|
|
38
38
|
private
|
|
39
39
|
|
|
40
|
+
def signal_workers: () -> untyped
|
|
41
|
+
|
|
42
|
+
def wait_for_workers: () -> untyped
|
|
43
|
+
|
|
44
|
+
def wait_for_workers_with_timeout: () -> untyped
|
|
45
|
+
|
|
40
46
|
def validate_processor!: (untyped processor) -> (nil | untyped)
|
|
41
47
|
|
|
42
48
|
def build_worker: (untyped processor) -> untyped
|
data/sig/shims/cdc_core.rbs
CHANGED
|
@@ -2,7 +2,7 @@ module CDC
|
|
|
2
2
|
module Core
|
|
3
3
|
class ProcessorResult
|
|
4
4
|
def self.success: (untyped event) -> ProcessorResult
|
|
5
|
-
def self.failure: (untyped error) -> ProcessorResult
|
|
5
|
+
def self.failure: (untyped error, ?event: untyped) -> ProcessorResult
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
class ChangeEvent
|
|
@@ -11,4 +11,4 @@ module CDC
|
|
|
11
11
|
class TransactionEnvelope
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
|
-
end
|
|
14
|
+
end
|