ruby_event_store-outbox 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_event_store/outbox/cleanup_strategies/none.rb +1 -0
- data/lib/ruby_event_store/outbox/consumer.rb +16 -1
- data/lib/ruby_event_store/outbox/consumer_process.rb +6 -0
- data/lib/ruby_event_store/outbox/repository.rb +5 -0
- data/lib/ruby_event_store/outbox/sidekiq_message_handler.rb +19 -0
- data/lib/ruby_event_store/outbox/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14cc2d7efea5445a91aad847cf380e9a5b743c2aa649ee8ca1d07b0093b13c36
|
4
|
+
data.tar.gz: 3a42ce8411f6c7fe36acb2007b13b392570859c52f0111bad22db9be09216720
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8919dc60db4ba6f37822a6fd1eff751b06b8c748f310c521157e2e41630bbe8b20705e93edeb66d1891f93c2cd9717cc407513bc2194e4c7f979102c540c3618
|
7
|
+
data.tar.gz: a78188907f82607f3f3cf164b554748af7603589c8a60ab25face59d5d5efd73c3ea14cfaf6b599bd1abe2b6162efa978565ebdcc24ec68102f5a03f172b8737
|
@@ -148,7 +148,7 @@ module RubyEventStore
|
|
148
148
|
|
149
149
|
release_lock_for_process(fetch_specification)
|
150
150
|
|
151
|
-
|
151
|
+
cleanup(fetch_specification)
|
152
152
|
|
153
153
|
processor.after_batch
|
154
154
|
|
@@ -218,6 +218,21 @@ module RubyEventStore
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
221
|
+
def cleanup(fetch_specification)
|
222
|
+
result = cleanup_strategy.call(fetch_specification)
|
223
|
+
case result
|
224
|
+
when :ok
|
225
|
+
when :deadlocked
|
226
|
+
logger.warn "Cleanup for split_key '#{fetch_specification.split_key}' failed (deadlock)"
|
227
|
+
metrics.write_operation_result("cleanup", "deadlocked")
|
228
|
+
when :lock_timeout
|
229
|
+
logger.warn "Cleanup for split_key '#{fetch_specification.split_key}' failed (lock timeout)"
|
230
|
+
metrics.write_operation_result("cleanup", "lock_timeout")
|
231
|
+
else
|
232
|
+
raise "Unexpected result #{result}"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
221
236
|
def prepare_traps
|
222
237
|
Signal.trap("INT") do
|
223
238
|
initiate_graceful_shutdown
|
@@ -147,6 +147,11 @@ module RubyEventStore
|
|
147
147
|
.for_fetch_specification(fetch_specification)
|
148
148
|
.where("enqueued_at < ?", duration.ago)
|
149
149
|
.delete_all
|
150
|
+
:ok
|
151
|
+
rescue ActiveRecord::Deadlocked
|
152
|
+
:deadlocked
|
153
|
+
rescue ActiveRecord::LockWaitTimeout
|
154
|
+
:lock_timeout
|
150
155
|
end
|
151
156
|
end
|
152
157
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "sidekiq"
|
2
|
+
|
3
|
+
module RubyEventStore
|
4
|
+
module Outbox
|
5
|
+
class SidekiqMessageHandler
|
6
|
+
def initialize
|
7
|
+
@sidekiq = Sidekiq::Client.new(Sidekiq.redis_pool)
|
8
|
+
end
|
9
|
+
|
10
|
+
def init
|
11
|
+
end
|
12
|
+
|
13
|
+
def handle_one_record(now, record)
|
14
|
+
hash_payload = JSON.parse(record.payload)
|
15
|
+
@sidekiq.__send__(:raw_push, [hash_payload])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_event_store-outbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_event_store
|
@@ -55,12 +55,14 @@ files:
|
|
55
55
|
- lib/ruby_event_store/outbox/cleanup_strategies/none.rb
|
56
56
|
- lib/ruby_event_store/outbox/cli.rb
|
57
57
|
- lib/ruby_event_store/outbox/consumer.rb
|
58
|
+
- lib/ruby_event_store/outbox/consumer_process.rb
|
58
59
|
- lib/ruby_event_store/outbox/fetch_specification.rb
|
59
60
|
- lib/ruby_event_store/outbox/metrics.rb
|
60
61
|
- lib/ruby_event_store/outbox/metrics/influx.rb
|
61
62
|
- lib/ruby_event_store/outbox/metrics/null.rb
|
62
63
|
- lib/ruby_event_store/outbox/repository.rb
|
63
64
|
- lib/ruby_event_store/outbox/sidekiq5_format.rb
|
65
|
+
- lib/ruby_event_store/outbox/sidekiq_message_handler.rb
|
64
66
|
- lib/ruby_event_store/outbox/sidekiq_processor.rb
|
65
67
|
- lib/ruby_event_store/outbox/sidekiq_producer.rb
|
66
68
|
- lib/ruby_event_store/outbox/sidekiq_scheduler.rb
|
@@ -87,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
89
|
- !ruby/object:Gem::Version
|
88
90
|
version: '0'
|
89
91
|
requirements: []
|
90
|
-
rubygems_version: 3.0.
|
92
|
+
rubygems_version: 3.0.3
|
91
93
|
signing_key:
|
92
94
|
specification_version: 4
|
93
95
|
summary: Active Record based outbox for Ruby Event Store
|