rails-transactional-outbox 0.3.1 → 0.4.0
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -0
- data/lib/rails_transactional_outbox/configuration.rb +7 -1
- data/lib/rails_transactional_outbox/outbox_model.rb +2 -1
- data/lib/rails_transactional_outbox/record_processors/active_record_processor.rb +1 -3
- data/lib/rails_transactional_outbox/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: 20d98c7e305f01ecd8e54b92170a117c01a412d050acab60899835b99a0d7d0c
|
4
|
+
data.tar.gz: 1658aadc54b3a01dd1e48274055befa210638df3b1fdc60bdd5a0bb2f858e1ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c6ef520d685476d27fc71f3c3bcac986248ab5d62addd2840238ed020136622cea9c4d20f0ade4fe6d693ffa3545531152d4a57465b72a6cb7a91112a2d5d0
|
7
|
+
data.tar.gz: 9efa9ef99b4c610f89c9ae22d2b5bd0592c0535667d46636e69a8d219cb3e92dda648d315ccf56ca8cfe01f3ae9ccb8588d4f51742072a6309829a68da33614e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -9,7 +9,7 @@ GIT
|
|
9
9
|
PATH
|
10
10
|
remote: .
|
11
11
|
specs:
|
12
|
-
rails-transactional-outbox (0.
|
12
|
+
rails-transactional-outbox (0.4.0)
|
13
13
|
activerecord (>= 5)
|
14
14
|
activesupport (>= 3.2)
|
15
15
|
concurrent-ruby
|
@@ -121,7 +121,7 @@ GEM
|
|
121
121
|
tzinfo (2.0.5)
|
122
122
|
concurrent-ruby (~> 1.0)
|
123
123
|
unicode-display_width (2.2.0)
|
124
|
-
zeitwerk (2.6.
|
124
|
+
zeitwerk (2.6.12)
|
125
125
|
|
126
126
|
PLATFORMS
|
127
127
|
x86_64-darwin-18
|
data/README.md
CHANGED
@@ -45,6 +45,7 @@ Rails.application.config.to_prepare do
|
|
45
45
|
config.lock_expiry_time = 10_000 # not required, defaults to 10_000, the unit is milliseconds
|
46
46
|
config.outbox_entries_processor = `RailsTransactionalOutbox::OutboxEntriesProcessors::OrderedByCausalityKeyProcessor`.new # not required, defaults to RailsTransactionalOutbox::OutboxEntriesProcessors::NonOrderedProcessor.new
|
47
47
|
config.outbox_entry_causality_key_resolver = ->(model) { model.tenant_id } # not required, defaults to a lambda returning nil. Needed when using `outbox_entry_causality_key_resolver`
|
48
|
+
config.unprocessed_causality_keys_limit = 100_000 # not required, defaults to 10_000. Might be a good idea to decrease the value when you start experiencing OOMs - they are likely to be caused by fetching too many causality keys. It is likely to happen when you have huge amount of records to process.
|
48
49
|
end
|
49
50
|
end
|
50
51
|
```
|
@@ -6,7 +6,7 @@ class RailsTransactionalOutbox
|
|
6
6
|
attr_writer :error_handler, :transactional_outbox_worker_sleep_seconds,
|
7
7
|
:transactional_outbox_worker_idle_delay_multiplier, :outbox_batch_size, :outbox_entries_processor,
|
8
8
|
:lock_client, :lock_expiry_time, :outbox_entry_causality_key_resolver,
|
9
|
-
:raise_not_found_model_error
|
9
|
+
:raise_not_found_model_error, :unprocessed_causality_keys_limit
|
10
10
|
|
11
11
|
def error_handler
|
12
12
|
@error_handler || RailsTransactionalOutbox::ErrorHandlers::NullErrorHandler
|
@@ -55,5 +55,11 @@ class RailsTransactionalOutbox
|
|
55
55
|
def outbox_entry_causality_key_resolver
|
56
56
|
@outbox_entry_causality_key_resolver || ->(_model) {}
|
57
57
|
end
|
58
|
+
|
59
|
+
def unprocessed_causality_keys_limit
|
60
|
+
return @unprocessed_causality_keys_limit.to_i if defined?(@unprocessed_causality_keys_limit)
|
61
|
+
|
62
|
+
10_000
|
63
|
+
end
|
58
64
|
end
|
59
65
|
end
|
@@ -24,9 +24,10 @@ class RailsTransactionalOutbox
|
|
24
24
|
.where("retry_at IS NULL OR retry_at <= ?", Time.current)
|
25
25
|
}
|
26
26
|
|
27
|
-
def self.unprocessed_causality_keys
|
27
|
+
def self.unprocessed_causality_keys(limit: RailsTransactionalOutbox.configuration.unprocessed_causality_keys_limit)
|
28
28
|
processable_now
|
29
29
|
.select("causality_key")
|
30
|
+
.limit(limit)
|
30
31
|
.distinct
|
31
32
|
.pluck(:causality_key)
|
32
33
|
end
|
@@ -17,9 +17,7 @@ class RailsTransactionalOutbox
|
|
17
17
|
def call(record)
|
18
18
|
model = record.infer_model
|
19
19
|
if model.nil?
|
20
|
-
if RailsTransactionalOutbox.configuration.raise_not_found_model_error?
|
21
|
-
raise CouldNotFindModelError.new(record)
|
22
|
-
end
|
20
|
+
raise CouldNotFindModelError.new(record) if RailsTransactionalOutbox.configuration.raise_not_found_model_error?
|
23
21
|
|
24
22
|
return
|
25
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-transactional-outbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karol Galanciak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|