positioning 0.4.1 → 0.4.2

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: fdc57e74504d876181c7f4b4355f4a3b2831bb8da768164fa4ff6aaf00655164
4
- data.tar.gz: ed8daeb88c81490abfc233e9c853b19dd38da72e7ec5c05648cc4e221dbab62e
3
+ metadata.gz: cf799b4590dc7a86e63c7ba46fe624bd7c6353989a6d33833942b30dd0c5bd46
4
+ data.tar.gz: 773a8c4b1f0cc6d528577c8d5c8f0263e310a5e8e3f2e69beeeaf9265e063dca
5
5
  SHA512:
6
- metadata.gz: 5ebe0ebd308d7937b6838d819e64bf8ce3728bf938c2c69b123c264cd351b8f6a20e66406abcda68c091ef4a6fdb270b638eccab0310eb1776ca8bd06ba7bded
7
- data.tar.gz: edcfe4c7f0ca38e6660f956910c6f7d6a70430ffe6949bb098c28ba37d95aaafc33cacdfd3e002a6384fb43c84e9c625b2cbf8498a541cc850bf9e9a9e85bf69
6
+ metadata.gz: 50423eee7719178be13087622bcc14b4a9e74974bdb0685fe7281838cc7cca8f784251b81a28d92e848a2b2eb7b79e4081a3ad4043ed483200f51341c71bf82f
7
+ data.tar.gz: e2ccbac3a7d0994e997a0b17907becc017893d5355fa9c06a745828b8ec90661076332e9ef1769bd9c0f6c1f8ba808e3d209e0f56b9acdf33d4e1ba6e5d9bd88
data/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.4.1] - 2024-10-12
3
+ ## [0.4.2] - 2024-11-08
4
+
5
+ NOTE: Versions 0.4.0 and 0.4.1 contain fatal flaws with the locking logic. Upgrade as soon as you can.
6
+
7
+ - Fix cases where locking wasn't executed where there were no associated scopes.
8
+ - Fix locking causing the in-memory record to be reloaded from the database. We only need the lock, not the reloaded record.
9
+
10
+ ## [0.4.1] - 2024-11-07
4
11
 
5
12
  - Fix locking where a `belongs_to` association is `optional: true`.
6
13
 
7
- ## [0.4.0] - 2024-10-12
14
+ ## [0.4.0] - 2024-11-07
8
15
 
9
16
  - BREAKING CHANGE: Advisory Lock has been removed. If you explicitly define `advisory_lock: false` in your `positioned` call, you'll need to remove this.
10
17
  - CAUTION: The Advisory Lock replacement is row locking. Where `belongs_to` associations exist, we lock the associated record(s), and that limits the locking scope down to the record's current scope, and potentially the scope it belonged to before a change in scope. If there are no `belongs_to` associations then the records that belong to the current (and potentially new) scope are locked, or all the records in the table are locked if there is no scope. Please report any deadlock issues.
@@ -192,17 +192,19 @@ module Positioning
192
192
  if scope_associations.present?
193
193
  scope_associations.each do |scope_association|
194
194
  if @positioned.persisted? && positioning_scope_changed?
195
- record_scope.first.send(scope_association)&.lock!
195
+ associated_record = record_scope.first.send(scope_association)
196
+ associated_record.class.base_class.lock.find(associated_record.id) if associated_record
196
197
  end
197
198
 
198
- @positioned.send(scope_association)&.lock!
199
+ associated_record = @positioned.send(scope_association)
200
+ associated_record.class.base_class.lock.find(associated_record.id) if associated_record
199
201
  end
200
202
  else
201
203
  if @positioned.persisted? && positioning_scope_changed?
202
- positioning_scope_was.lock!
204
+ positioning_scope_was.lock.all.load
203
205
  end
204
206
 
205
- positioning_scope.lock!
207
+ positioning_scope.lock.all.load
206
208
  end
207
209
  end
208
210
 
@@ -1,3 +1,3 @@
1
1
  module Positioning
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendon Muir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-06 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport