culturecode_stagehand 0.14.3 → 0.14.4
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/lib/stagehand/staging/synchronizer.rb +9 -3
- data/lib/stagehand/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0691ceae72d5001db6bd38f259157f4a82dff1e
|
|
4
|
+
data.tar.gz: 09816a1e820606659d76695e32854109979e024a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbe697859ad03c61ece9f6f0e986933dcb6266f86eeecc6d3a13c3775ae1d8063c5721888637055f8bf93ef5099d384d2ea6ee0e5d937001f4cc87f2da2f2100
|
|
7
|
+
data.tar.gz: 68dbd5120d87b68da524d3de44d77368ce810ca1a205ab6cc73d0ac5b5ae0702f89750f58068a215642aa871ad4796dde4701bfa0484159fbbd0a1240acd0976
|
|
@@ -102,8 +102,8 @@ module Stagehand
|
|
|
102
102
|
return unless entries.present?
|
|
103
103
|
|
|
104
104
|
Database.transaction do
|
|
105
|
-
# Lock the records so nothing can update them
|
|
106
|
-
|
|
105
|
+
# Lock the records so nothing can update them after we confirm autosyncability
|
|
106
|
+
acquire_record_locks(entries)
|
|
107
107
|
|
|
108
108
|
# Execute the block for each entry we've confirm autosyncability
|
|
109
109
|
confirmed_ids = Set.new(autosyncable_entries.where(:id => entries).pluck(:id))
|
|
@@ -114,6 +114,12 @@ module Stagehand
|
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
# Does not actually acquire a lock, instead it triggers a 'first read' so the transaction will ensure subsequent
|
|
118
|
+
# reads of the locked rows return the same value, even if modified outside of the transaction
|
|
119
|
+
def acquire_record_locks(entries)
|
|
120
|
+
entries.each(&:record)
|
|
121
|
+
end
|
|
122
|
+
|
|
117
123
|
def autosyncable_entries(scope = nil)
|
|
118
124
|
entries = CommitEntry.content_operations.not_in_progress.where(scope)
|
|
119
125
|
entries = entries.with_uncontained_keys unless Configuration.ghost_mode?
|
|
@@ -143,7 +149,7 @@ module Stagehand
|
|
|
143
149
|
|
|
144
150
|
def run_sync_callbacks(entry, callbacks, &block)
|
|
145
151
|
callbacks = Array.wrap(callbacks).dup
|
|
146
|
-
return block.call unless
|
|
152
|
+
return block.call unless callbacks.present? && entry.record
|
|
147
153
|
|
|
148
154
|
entry.record.run_callbacks(callbacks.shift) do
|
|
149
155
|
run_sync_callbacks(entry, callbacks, &block)
|
data/lib/stagehand/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: culturecode_stagehand
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.14.
|
|
4
|
+
version: 0.14.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicholas Jakobsen
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|