yes-core 2.8.1 → 2.8.2
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/CHANGELOG.md +3 -0
- data/lib/yes/core/command_handling/read_model_revision_guard.rb +6 -1
- data/lib/yes/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ea54d7585d45303f0330a908bb93226d4c1901bd83f3a224dfcd11c41033406
|
|
4
|
+
data.tar.gz: 80488fd3c7a9462d228b6c935ad323062eded7d21c501827aa27c3032eafd09b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e97053eb6e34d272fb6a8651961a0cd2bba24c7b67e5ebce6fca025a55a2751f64dc496736208de97c57e56284feb3afba3ece7fd43c9803d16d782f77dd32b
|
|
7
|
+
data.tar.gz: 2718324306ecc186004b123d0ecf66e4b1679cdc68feaf1d1936c2c69caea23ffd17fd19447cbcf28ab7ff2dc75815f7c2764a8edc719923adfb3986a39539f8
|
data/CHANGELOG.md
CHANGED
|
@@ -131,12 +131,17 @@ module Yes
|
|
|
131
131
|
# Locks and reloads the read model row, re-checks the revision and yields.
|
|
132
132
|
# The lock is held until the surrounding transaction (if any) ends.
|
|
133
133
|
#
|
|
134
|
+
# Uses +reload(lock: true)+ inside a transaction instead of +with_lock+. +with_lock+ raises when the record
|
|
135
|
+
# has unsaved changes, which is the case when a transaction retry extension (serialization failure,
|
|
136
|
+
# deadlock) re-runs this block after the previous attempt assigned attributes. +reload+ discards them.
|
|
137
|
+
#
|
|
134
138
|
# @yield Block to execute while the row is locked
|
|
135
139
|
# @return [Object] Result of the block execution
|
|
136
140
|
# @raise [RevisionAlreadyAppliedError] When another writer applied the revision in the meantime
|
|
137
141
|
# @raise [RevisionMismatchError] When the locked row is behind the expected revision
|
|
138
142
|
def with_row_lock
|
|
139
|
-
read_model.
|
|
143
|
+
read_model.transaction do
|
|
144
|
+
read_model.reload(lock: true)
|
|
140
145
|
check_revision_status!
|
|
141
146
|
raise RevisionMismatchError, revision_mismatch_message unless revision_matches?
|
|
142
147
|
|
data/lib/yes/core/version.rb
CHANGED