gdpr_admin 1.8.1 → 1.9.0

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: 172250ede69ee6974d2fc726b72ab0677c36f3351908fad095021993c9dd58d9
4
- data.tar.gz: d3657ee4898b7dce3287f3ca85eae1bfdfd906976cce57d8a9605c5c44670b43
3
+ metadata.gz: 9f2e3eb2d8eea4c910112fa0ca7c4fd4ac77816137321022205684a583086315
4
+ data.tar.gz: 9ac8e526d9a38a54a88557a58cee645aa0a80aa2362fe01dfbd41f719440ae67
5
5
  SHA512:
6
- metadata.gz: 57543c6cb8f3ddcca87add6b21b627bfc06e4e44fa62a3df50308bc432aa0e2dc6ba88f46acdee88b384ec1bd9b431b6b5da609d16fdfc8f17f13df4a616e637
7
- data.tar.gz: 75a2c55441cce17d181b6a47368c7e3cb491cce5e9e53c354ffc55428c64059c3d4547bfb8e36703022716848b9df910ca3ae4d9e64c23f84372bdbc374bd32b
6
+ metadata.gz: d320fa119e9adecadce0703e19655a8267e11b159a8f5da6854fa939cc2c6002c0290b12b4f1729f21cbcfe82de098e540156165358b925ae6133c9ae11350e8
7
+ data.tar.gz: f4ef6c026b32d33c9f05bd0dca8b1ec2ded1b66f22e7f477a874418bf4dbefac918c4ec3926e96cf483ff3fe19be12274a15791e994c6310928f2223c5727dbf
data/README.md CHANGED
@@ -382,6 +382,15 @@ GdprAdmin.configure do |config|
382
382
  end
383
383
  ```
384
384
 
385
+ #### Rollback on Failure
386
+ By default, GDPR Admin will attempt to rollback all changes made during the processing a Request in case it fails during the processing. This can be turned of with the flag `rollback_on_failure`. In this situation, all changes will be committed as soon as they are done.
387
+
388
+ ```ruby
389
+ GdprAdmin.configure do |config|
390
+ config.rollback_on_failure = false
391
+ end
392
+ ```
393
+
385
394
  ### Jobs
386
395
  Requests are processed asynchronously using ActiveJob.
387
396
 
@@ -41,8 +41,8 @@ module GdprAdmin
41
41
 
42
42
  def process!
43
43
  GdprAdmin.load_data_policies
44
- reload.with_lock { processing! }
45
- with_lock do
44
+ reload.lock_strategy { processing! }
45
+ lock_strategy do
46
46
  process_policies
47
47
  completed!
48
48
  end
@@ -67,6 +67,13 @@ module GdprAdmin
67
67
  RequestProcessorJob.set(wait: grace_period).perform_later(self)
68
68
  end
69
69
 
70
+ def lock_strategy(&block)
71
+ return with_lock(&block) if GdprAdmin.config.rollback_on_failure
72
+ return with_advisory_lock(to_global_id.to_s, &block) if respond_to?(:with_advisory_lock)
73
+
74
+ yield
75
+ end
76
+
70
77
  private
71
78
 
72
79
  def grace_period
@@ -3,7 +3,7 @@
3
3
  module GdprAdmin
4
4
  class Configuration
5
5
  attr_accessor :tenant_class, :data_policies_path, :default_job_queue,
6
- :erasure_grace_period, :export_grace_period
6
+ :erasure_grace_period, :export_grace_period, :rollback_on_failure
7
7
  attr_writer :tenant_adapter
8
8
 
9
9
  def initialize
@@ -13,6 +13,7 @@ module GdprAdmin
13
13
  @default_job_queue = :default
14
14
  @erasure_grace_period = 4.hours
15
15
  @export_grace_period = nil
16
+ @rollback_on_failure = true
16
17
  end
17
18
 
18
19
  def tenant_adapter
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module GdprAdmin
5
- VERSION = '1.8.1'
5
+ VERSION = '1.9.0'
6
6
  end
7
7
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdpr_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-06 00:00:00.000000000 Z
11
+ date: 2024-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails