switchman 3.5.10 → 3.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman/active_record/base.rb +13 -1
- data/lib/switchman/active_record/persistence.rb +4 -0
- data/lib/switchman/version.rb +1 -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: 9a18e4da75efcd07fcf8d46d08397d2323c7795f3f971a66561e03944383bf4e
|
4
|
+
data.tar.gz: 65963d628b6a011a7e29d7b76735f6d6318afec42b3359e5cd4c6f4c21e591c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 278b27e999056a7b9a8bf1fbed3f4de12b110fc269410b7ffaf4c7fdcd340ef37e2af8174dd2ce499e90ab07483ee057261067224c474053707ab2de67c3c41c
|
7
|
+
data.tar.gz: 5d9aa9b061b88fe2ea62d11005eaf4db9e05c9c65da11fd6d82bdaf5ddb707507bd024b95a2b9fca1ab3b194a158fbfc8ce66e5f6b5d5f9bf9327cd121d897ba
|
@@ -158,7 +158,15 @@ module Switchman
|
|
158
158
|
end
|
159
159
|
|
160
160
|
@loaded_from_shard ||= Shard.current(self.class.connection_class_for_self)
|
161
|
-
|
161
|
+
if shadow_record? && !Switchman.config[:writable_shadow_records]
|
162
|
+
@readonly = true
|
163
|
+
@readonly_from_shadow ||= true
|
164
|
+
end
|
165
|
+
super
|
166
|
+
end
|
167
|
+
|
168
|
+
def readonly!
|
169
|
+
@readonly_from_shadow = false
|
162
170
|
super
|
163
171
|
end
|
164
172
|
|
@@ -169,6 +177,10 @@ module Switchman
|
|
169
177
|
pkey > Shard::IDS_PER_SHARD
|
170
178
|
end
|
171
179
|
|
180
|
+
def canonical?
|
181
|
+
!shadow_record?
|
182
|
+
end
|
183
|
+
|
172
184
|
def save_shadow_record(new_attrs: attributes, target_shard: Shard.current)
|
173
185
|
return if target_shard == shard
|
174
186
|
|
@@ -34,6 +34,10 @@ module Switchman
|
|
34
34
|
# When a shadow record is reloaded the real record is returned. So
|
35
35
|
# we need to ensure the loaded_from_shard is set correctly after a reload.
|
36
36
|
@loaded_from_shard = @shard
|
37
|
+
if @readonly_from_shadow
|
38
|
+
@readonly_from_shadow = false
|
39
|
+
@readonly = false
|
40
|
+
end
|
37
41
|
res
|
38
42
|
end
|
39
43
|
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-10-
|
13
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|