sidekiq-activerecord-shard 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 758bc7c30968cfc3961024118a4e4dd4f0bbefd4d99995ad7465f05691bac4eb
4
- data.tar.gz: ae47127827bf9933229f22a3e104b698e2591e79acbba39e929b2515220bdb98
3
+ metadata.gz: a8381904a8af934466f4f06293c2c5bbf76fa72f2d23071f475b6930f12a8a25
4
+ data.tar.gz: a9541f4e5f55f1273d74ca1a860174b36c826baebc3f872dba3e96ae33b28efc
5
5
  SHA512:
6
- metadata.gz: 17fcce8d7723e936f85bc1a8d15448dc7ce89035f29cfc0f1f0d9484bae5793adf66d01c05dc2e00af36e576d1a01e12810ad103d75215d3d269a7be79b59248
7
- data.tar.gz: fafdc2936270b3bc3237baa794559632977c304c69c01ff8057d5c6ea0379c57df8771cf9a0d9e7f32cc28c16b5ab290167e76e03192ff8ac2c46d04813d3500
6
+ metadata.gz: 3a4a9fe58e64c0bb7acbdf789896f5c41e463567eb3f4070201dcb0d1d479491838a40515f5249ff9e5c80e3e0b3c68ce1ab5f0ecfa2e87252702f0a93b7e3dc
7
+ data.tar.gz: 0a6a28a40e51c6f1d031d762d93e3026ddd36c5717a5c84e66225828d2678fff701546bac4478278f9116453ba78ae57ac1d806a18422bb1f3d2a090fdd0520e
@@ -6,7 +6,12 @@ module SidekiqActiveRecordShard
6
6
 
7
7
  def call(_jobclass, job, _queue, _redis)
8
8
  # Store shard value in Job arguments
9
- job["_active_record_shard"] = SidekiqActiveRecordShard.config.selected_shard.call
9
+ shard = SidekiqActiveRecordShard.config.selected_shard.call
10
+ if shard.nil?
11
+ raise "No shard selected, SidekiqActiveRecordShard.config.selected_shard return nil."
12
+ end
13
+
14
+ job["_active_record_shard"] = shard
10
15
  yield
11
16
  end
12
17
  end
@@ -19,7 +24,7 @@ module SidekiqActiveRecordShard
19
24
 
20
25
  # Inspired by ActiveRecord::Middleware::ShardSelector
21
26
  # https://github.com/rails/rails/blob/v7.0.3/activerecord/lib/active_record/middleware/shard_selector.rb#L54
22
- def set_shard(shared, &block)
27
+ def set_shard(shard, &block)
23
28
  options = Rails.application.config.active_record.shard_selector
24
29
 
25
30
  ActiveRecord::Base.connected_to(shard: shard.to_sym) do
@@ -1,3 +1,3 @@
1
1
  module SidekiqActiveRecordShard
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-activerecord-shard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee