ruby_event_store-outbox 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f971d2c4366655940f73a71fd28822d7b07351b3365b8b7fcef56c1f667c38
|
4
|
+
data.tar.gz: 4cf6356f1b559d277b5ef17a39ef4158eea7e6e35ec2eba0705e985fd1555c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25f09627e62a3a856709c8dd331b43d48ca8d7001690704e91de7d488291765f013986785131fd8bb24c383b2cd207802a4b34f960d09375287388c27ddd29b
|
7
|
+
data.tar.gz: 788200eaba625da46a762304071fe6a24699f23cc6da179069672afbb7ad1ab57e22c391308ca04e90e21a872b5b373abdb83d188c797cb8bd6463c513788171
|
@@ -32,7 +32,10 @@ module RubyEventStore
|
|
32
32
|
def run
|
33
33
|
while !@gracefully_shutting_down do
|
34
34
|
was_something_changed = one_loop
|
35
|
-
|
35
|
+
if !was_something_changed
|
36
|
+
STDOUT.flush
|
37
|
+
sleep SLEEP_TIME_WHEN_NOTHING_TO_DO
|
38
|
+
end
|
36
39
|
end
|
37
40
|
logger.info "Gracefully shutting down"
|
38
41
|
end
|
@@ -65,6 +68,9 @@ module RubyEventStore
|
|
65
68
|
logger.info "Sent #{records.size} messages from outbox table"
|
66
69
|
return true
|
67
70
|
end
|
71
|
+
rescue ActiveRecord::Deadlocked
|
72
|
+
logger.warn "Outbox fetch deadlocked"
|
73
|
+
false
|
68
74
|
end
|
69
75
|
|
70
76
|
private
|
@@ -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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_event_store
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/ruby_event_store/outbox/consumer.rb
|
56
56
|
- lib/ruby_event_store/outbox/record.rb
|
57
57
|
- lib/ruby_event_store/outbox/sidekiq5_format.rb
|
58
|
+
- lib/ruby_event_store/outbox/sidekiq_message_handler.rb
|
58
59
|
- lib/ruby_event_store/outbox/sidekiq_scheduler.rb
|
59
60
|
- lib/ruby_event_store/outbox/version.rb
|
60
61
|
homepage: https://railseventstore.org
|