switchman 2.1.2 → 2.1.3
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/switchman/active_record/attribute_methods.rb +11 -1
- data/lib/switchman/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62fa2df72b999208e937ba7df468f122159e573d3e838cf86df601592e64fb0c
|
|
4
|
+
data.tar.gz: 20e83c56b8043a8d5e9fbc433db4b1a26a6ec7291389c59463a47ea2ed0b0b87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c2cdc6f074ddb755b8a80dad67a2828a8f52d2c034f9ec7bdf473d2e2241cf21b80969cc3f6d0dcc33b6713f299ea976370800640a54839d0895cd41c29f01a
|
|
7
|
+
data.tar.gz: 68651c29f71fad57c1e6bbc02b35c6e607a98bc708045841b547c07de4f0ce63048d4a22b22c561d4692a728adc8740fd139ef4d88e5e777cf593e1de679ca9b
|
|
@@ -103,8 +103,18 @@ module Switchman
|
|
|
103
103
|
def __temp_relative_attribute__
|
|
104
104
|
raw_value = original_#{attr_name}
|
|
105
105
|
return nil if raw_value.nil?
|
|
106
|
+
|
|
107
|
+
abs_raw_value = raw_value.abs
|
|
106
108
|
current_shard = Shard.current(#{shard_category_code_for_reflection(reflection)})
|
|
107
|
-
|
|
109
|
+
same_shard = shard == current_shard
|
|
110
|
+
return raw_value if same_shard && abs_raw_value < Shard::IDS_PER_SHARD
|
|
111
|
+
|
|
112
|
+
value_shard_id = abs_raw_value / Shard::IDS_PER_SHARD
|
|
113
|
+
# this is a stupid case when someone stuffed a global id for the current shard in instead
|
|
114
|
+
# of a local id
|
|
115
|
+
return raw_value % Shard::IDS_PER_SHARD if value_shard_id == current_shard.id
|
|
116
|
+
return raw_value if !same_shard && abs_raw_value > Shard::IDS_PER_SHARD
|
|
117
|
+
return shard.global_id_for(raw_value) if !same_shard && abs_raw_value < Shard::IDS_PER_SHARD
|
|
108
118
|
|
|
109
119
|
Shard.relative_id_for(raw_value, shard, current_shard)
|
|
110
120
|
end
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: switchman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cody Cutrer
|
|
8
8
|
- James Williams
|
|
9
9
|
- Jacob Fugal
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
date: 2021-07-29 00:00:00.000000000 Z
|
|
@@ -257,7 +257,7 @@ homepage: http://www.instructure.com/
|
|
|
257
257
|
licenses:
|
|
258
258
|
- MIT
|
|
259
259
|
metadata: {}
|
|
260
|
-
post_install_message:
|
|
260
|
+
post_install_message:
|
|
261
261
|
rdoc_options: []
|
|
262
262
|
require_paths:
|
|
263
263
|
- lib
|
|
@@ -272,8 +272,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
272
272
|
- !ruby/object:Gem::Version
|
|
273
273
|
version: '0'
|
|
274
274
|
requirements: []
|
|
275
|
-
rubygems_version: 3.
|
|
276
|
-
signing_key:
|
|
275
|
+
rubygems_version: 3.2.24
|
|
276
|
+
signing_key:
|
|
277
277
|
specification_version: 4
|
|
278
278
|
summary: Rails sharding magic
|
|
279
279
|
test_files: []
|