yam-db-charmer 1.7.4.8 → 1.7.4.9
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.
@@ -14,10 +14,11 @@ module DbCharmer
|
|
14
14
|
|
15
15
|
# The block passed to this function should return an object responding to key_field
|
16
16
|
def create_with_allocated_shard(key_field = :id, &block)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
sharder = sharded_connection.sharder
|
18
|
+
group = sharder.least_loaded_group
|
19
|
+
shard_info = sharder.shard_info_by_group_id(group.id)
|
20
|
+
conn = sharder.shard_connection_config(shard_info, group.id)
|
21
|
+
key_obj = on_db(conn, nil, &block)
|
21
22
|
allocate_new_block_for_key_on_group(key_obj.send(key_field), group)
|
22
23
|
key_obj
|
23
24
|
end
|
data/lib/db_charmer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yam-db-charmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 101
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
9
|
- 4
|
10
|
-
-
|
11
|
-
version: 1.7.4.
|
10
|
+
- 9
|
11
|
+
version: 1.7.4.9
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Oleksiy Kovyrin
|