journaled 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/journaled/audit_log.rb +1 -1
- data/lib/journaled/connection.rb +2 -2
- data/lib/journaled/version.rb +1 -1
- data/lib/journaled.rb +13 -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: 677d0f45ee5a62e362e5889cfee0745e6645be394617b60585302ccbf28099a0
|
4
|
+
data.tar.gz: 30c02276b17d9cfce2534f530806b2b037c42e0b3708ef0d10b194f295f09e74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b5fb2a36241ea80bfe6f07965fe048e9b5f246ff71e77c61259d78f9739e41b20a3dcf669a2ab1514169c95e01d2b8e21ac885beaa943243b6abc2ad673deb
|
7
|
+
data.tar.gz: 65baecc64ef3f99fae2e45e5133ec844cf16fcaad2463b103d8d03ad95eb32de52bde0341a58c07c65a25935359e80913806d68b12cea2de74f48517ce2d177a
|
data/README.md
CHANGED
@@ -682,6 +682,14 @@ This feature can be disabled conditionally:
|
|
682
682
|
Journaled.transactional_batching_enabled = false
|
683
683
|
```
|
684
684
|
|
685
|
+
And can then be enabled via the following block:
|
686
|
+
|
687
|
+
```ruby
|
688
|
+
Journaled.with_transactional_batching do
|
689
|
+
# your code
|
690
|
+
end
|
691
|
+
```
|
692
|
+
|
685
693
|
Backwards compatibility has been included for background jobs enqueued by
|
686
694
|
version 4.0 and above, but **has been dropped for jobs emitted by versions prior
|
687
695
|
to 4.0**. (Again, be sure to upgrade only one major version at a time.)
|
data/lib/journaled/audit_log.rb
CHANGED
data/lib/journaled/connection.rb
CHANGED
@@ -2,11 +2,11 @@ module Journaled
|
|
2
2
|
module Connection
|
3
3
|
class << self
|
4
4
|
def available?
|
5
|
-
Journaled.transactional_batching_enabled && transaction_open?
|
5
|
+
Journaled.transactional_batching_enabled? && transaction_open?
|
6
6
|
end
|
7
7
|
|
8
8
|
def stage!(event)
|
9
|
-
raise TransactionSafetyError, <<~MSG unless
|
9
|
+
raise TransactionSafetyError, <<~MSG unless available?
|
10
10
|
Transaction not available! By default, journaled event batching requires an open database transaction.
|
11
11
|
MSG
|
12
12
|
|
data/lib/journaled/version.rb
CHANGED
data/lib/journaled.rb
CHANGED
@@ -16,7 +16,19 @@ module Journaled
|
|
16
16
|
mattr_accessor(:http_open_timeout) { 2 }
|
17
17
|
mattr_accessor(:http_read_timeout) { 60 }
|
18
18
|
mattr_accessor(:job_base_class_name) { 'ActiveJob::Base' }
|
19
|
-
|
19
|
+
mattr_writer(:transactional_batching_enabled) { true }
|
20
|
+
|
21
|
+
def self.transactional_batching_enabled?
|
22
|
+
Thread.current[:journaled_transactional_batching_enabled] || @@transactional_batching_enabled
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.with_transactional_batching
|
26
|
+
value_was = Thread.current[:journaled_transactional_batching_enabled]
|
27
|
+
Thread.current[:journaled_transactional_batching_enabled] = true
|
28
|
+
yield
|
29
|
+
ensure
|
30
|
+
Thread.current[:journaled_transactional_batching_enabled] = value_was
|
31
|
+
end
|
20
32
|
|
21
33
|
def self.development_or_test?
|
22
34
|
%w(development test).include?(Rails.env)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: journaled
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Lipson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activejob
|